abacus-clone

Does a deep copy of an array or object with an optional interceptor

Stats

StarsIssuesVersionUpdatedCreatedSize
abacus-clone
94551.1.53 years ago6 years agoMinified + gzip package size for abacus-clone in KB

Readme

abacus-clone

Creates a deep copy of an array or object such that modifying any level of the copy will not change anything on the original

The interceptor function is called on every property of the object passed including the object itself. It must return a value. If no interceptor function is passed, a default interceptor that results in a deep clone is used.

Example

interceptor(value, key)

(value, key) => {
  if(key === 'money')
    return value * 2;
  return value;
}

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.