1 | import {Operator} from 'vega-dataflow';
|
2 | import {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 | */
|
10 | export default function MultiValues(params) {
|
11 | Operator.call(this, null, update, params);
|
12 | }
|
13 |
|
14 | inherits(MultiValues, Operator);
|
15 |
|
16 | function update(_) {
|
17 | return (this.value && !_.modified())
|
18 | ? this.value
|
19 | : _.values.reduce(function(data, _) { return data.concat(_); }, []);
|
20 | }
|