Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
namespace TestArrayUpdate {
update([], {
foo: {
bar: { $set: 'baz' }
}
});
}
namespace TestExtend {
update.extend('$command', (specValue, originalValue) => originalValue);
}
namespace TestNewContext {
update.newContext().extend('$command', (specValue, originalValue) => originalValue);
newContext().extend('$command', (specValue, originalValue) => originalValue);
// This shouldn't compile, but we can't test negatives.
// newContext().newContext();
}
namespace TestFromReactDocs {
// These are copied from https://facebook.github.io/react/docs/update.html
let initialArray = [1, 2, 3];
let newArray = update(initialArray, { $push: [4] }); // => [1, 2, 3, 4]
let collection = [1, 2, { a: [12, 17, 15] }];
let newCollection = update(collection, { 2: { a: { $splice: [[1, 1, 13, 14]] } } });
// => [1, 2, {a: [12, 13, 14, 15]}]
let obj = { a: 5, b: 3 };
import * as _ from 'lodash';
import { newContext } from 'immutability-helper';
const update = newContext();
update.extend('$assign', (spec, object) => _.assign({}, object, spec));
import { ActionType, Action } from './atomicActions';
import { ChartState, DEFAULT_CHART_STATE, invalidLoader } from '../model/state';
import { DEFAULT_Y_DOMAIN } from '../model/constants';
import { objectWithKeys, replaceValuesWithConstant, objectWithKeysFromObject } from './reducerUtils';
export default function(state: ChartState, action: Action): ChartState {
if (state === undefined) {
return DEFAULT_CHART_STATE;
}
switch (action.type) {
case ActionType.SET_SERIES_IDS: {
const seriesIds = action.payload;