UNPKG

mutate-on-copy

Version:

mutate on copy

8 lines 283 B
export function mutate(target, fn) { if (!target) return target; const copyState = (Array.isArray(target) ? target.slice() : Object.assign({}, target)); const res = fn(copyState); return res === undefined ? copyState : res; } //# sourceMappingURL=index.js.map