Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function aggregateParams(_, pulse) {
var key = _.field,
value = _.value,
op = (_.op === 'count' ? '__count__' : _.op) || 'sum',
fields = accessorFields(key).concat(accessorFields(value)),
keys = pivotKeys(key, _.limit || 0, pulse);
// if data stream content changes, pivot fields may change
// flag parameter modification to ensure re-initialization
if (pulse.changed()) _.set('__pivot__', null, null, true);
return {
key: _.key,
groupby: _.groupby,
ops: keys.map(function() { return op; }),
fields: keys.map(function(k) { return get(k, key, value, fields); }),
as: keys.map(function(k) { return k + ''; }),
modified: _.modified.bind(_)
};
}
prototype.transform = function(_, pulse) {
var features = this._features,
points = this._points,
fields = _.fields,
lon = fields && fields[0],
lat = fields && fields[1],
geojson = _.geojson || (!fields && identity),
flag = pulse.ADD,
mod;
mod = _.modified()
|| pulse.changed(pulse.REM)
|| pulse.modified(accessorFields(geojson))
|| (lon && (pulse.modified(accessorFields(lon))))
|| (lat && (pulse.modified(accessorFields(lat))));
if (!this.value || mod) {
flag = pulse.SOURCE;
this._features = (features = []);
this._points = (points = []);
}
if (geojson) {
pulse.visit(flag, function(t) {
features.push(geojson(t));
});
}
if (lon && lat) {
pulse.visit(flag, function(t) {
function inputVisit(get) {
var fields = array(accessorFields(get)),
i = 0, n = fields.length, f;
for (; i
function dependency(f) {
if (!isFunction(f)) return false;
const set = toSet(accessorFields(f));
return set.$x || set.$y || set.$value || set.$max;
}
function update(_) {
var expr = _.expr;
return this.value && !_.modified('expr')
? this.value
: accessor(
datum => expr(datum, _),
accessorFields(expr),
accessorName(expr)
);
}
function modified(f, pulse) {
var k, v;
for (k in f) {
if (isFunction(v = f[k]) && pulse.modified(accessorFields(v)))
return 1;
}
return 0;
}
function visitInputs(f) {
array(accessorFields(f)).forEach(_ => inputs[_] = 1);
}
visitInputs(_.sort);