Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
prototype.transform = function(_, pulse) {
var out = pulse.fork(pulse.ALL),
shape = this.value,
as = _.as || 'shape',
flag = out.ADD;
if (!shape || _.modified()) {
// parameters updated, reset and reflow
this.value = shape = shapeGenerator(
getProjectionPath(_.projection),
_.field || field('datum'),
_.pointRadius
);
out.materialize().reflow();
flag = out.SOURCE;
}
out.visit(flag, function(t) { t[as] = shape; });
return out.modifies(as);
};
public build(ds: DatasetManager) {
// TODO: wire in source
if (!this.fromValue) {
throw new Error('kde distribution must define a source table')
}
if (!this.fieldValue) {
throw new Error('kde distribution must define a field value')
}
return {
function: 'kde',
from: ds.getTable(this.fromValue),
field: vegaField(this.fieldValue),
bandwidth: this.bandwidthValue,
}
}
}
function toField(value) {
if (value && isFunction(value.toObject)) {
value = value.toObject();
}
return isString(value) ? field(value)
: isObject(value) && !isFunction(value)
? isFunction(value.accessor)
? accessor(value.accessor, value.fields, value.as)
: field(value.field, value.as)
: null;
}
function getField(_, ctx) {
if (!_.$field) return null;
var k = 'f:' + _.$field + '_' + _.$name;
return ctx.fn[k] || (ctx.fn[k] = field(_.$field, _.$name));
}
function toField(value) {
if (value && isFunction(value.toObject)) {
value = value.toObject();
}
return isString(value) ? field(value)
: isObject(value) && !isFunction(value)
? isFunction(value.accessor)
? accessor(value.accessor, value.fields, value.as)
: field(value.field, value.as)
: null;
}
export default function TupleStore(key) {
this._key = key ? field(key) : tupleid;
this.reset();
}
export default function json(data, format) {
const prop = (format && format.property) ? field(format.property) : identity;
return isObject(data) && !isBuffer(data)
? parseJSON(prop(data))
: prop(JSON.parse(data));
}
groupby: this.groupByFields.map(c => vegaField(c)),
fields: this.computeFields.map(c =>