Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import {aggregate, window} from 'vega-transforms';
import {
accessor, array, compare, error, field,
isArray, isObject, isFunction, isRegExp, isString,
toBoolean, toNumber, toSet, toString
} from 'vega-util';
const Ascending = 'ascending',
Descending = 'descending',
AggregateOps = toSet(aggregate.Definition.params[1].values),
WindowOps = toSet(window.Definition.params[2].values);
export function parser(p) {
const type = p.array ? 'array' : p.type;
return TypeParsers[type](p);
}
export const TypeParsers = {
array: p => {
const len = p.length,
name = p.name,
type = TypeParsers[p.type];
return value => {
if (!isArray(value)) {
error(`Expected array parameter: ${name}.`);