avocado-old/packages/state/next-step.js
2019-04-07 16:46:07 -04:00

12 lines
250 B
JavaScript

export function nextStep(step) {
const {path, op, value} = step;
const parts = path.split('/');
const [key] = parts.splice(1, 1);
const subpath = parts.join('/');
return [key, {
op,
path: subpath ? subpath : '/',
value,
}];
}