UNPKG

534 BJavaScriptView Raw
1import {Operator} from 'vega-dataflow';
2import {inherits} from 'vega-util';
3
4/**
5 * Merge a collection of value arrays.
6 * @constructor
7 * @param {object} params - The parameters for this operator.
8 * @param {Array<Array<*>>} params.values - The input value arrrays.
9 */
10export default function MultiValues(params) {
11 Operator.call(this, null, update, params);
12}
13
14inherits(MultiValues, Operator);
15
16function update(_) {
17 return (this.value && !_.modified())
18 ? this.value
19 : _.values.reduce((data, _) => data.concat(_), []);
20}