UNPKG

vega-parser

Version:

Parse Vega specifications to runtime dataflows.

25 lines (21 loc) 537 B
import {isObject, stringValue} from 'vega-util'; export default function(clip, scope) { let expr; if (isObject(clip)) { if (clip.signal) { expr = clip.signal; } else if (clip.path) { expr = 'pathShape(' + param(clip.path) + ')'; } else if (clip.sphere) { expr = 'geoShape(' + param(clip.sphere) + ', {type: "Sphere"})'; } } return expr ? scope.signalRef(expr) : !!clip; } function param(value) { return isObject(value) && value.signal ? value.signal : stringValue(value); }