Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function createScale(dispatch: Dispatch, parsed: CompiledBinding, def: RangeScale): ActionType {
const {domain, ...rest} = def,
props = isDataRefDomain(domain)
? extend({}, rest, {_domain: [{data: parsed.map.data[domain.data], field: domain.field}]})
: def;
const action = addScale(Scale(props));
return (dispatch(action), action);
}
function equals(state: State, def: RangeScale, scale: ScaleRecord, dsMap): boolean {
if (scale.type !== def.type) {
return false;
}
if (JSON.stringify(scale.range) !== JSON.stringify(def.range)) {
return false;
}
if(isDataRefDomain(def.domain) && scale._domain) {
const domain = scale._domain[0];
if (domain.field !== def.domain.field) {
return false;
}
const pipeline = getInVis(state, `datasets.${domain.data}._parent`);
if (pipeline !== getInVis(state, `datasets.${dsMap[def.domain.data]}._parent`)) {
return false;
}
}
return true;
}