ffhaa.blogg.se

Fastcopy diff meaning
Fastcopy diff meaning













However, the expectation is that these subclasses would have the same constructur signature as their native base class. When copying, we explicitly reuse the constructor of the original object. Starting in ES2015, native globals can be subclassed like any custom class. The constructor of the original object is used, instead of using known globals As such, the original reference is copied. While it would be relatively trivial to copy over the message and stack to a new object of the same Error subclass, it is a common practice to "override" the message or stack, and copies would not retain this mutation.

fastcopy diff meaning

Error references are copied directly, instead of creating a new *Error object If your use-cases require different handling, you can always create your own custom copier with createCopier or createStrictCopier. For this library, some decisions were explicitly made for the default copiers of specific object types, and those decisions are detailed below. Inherently, what is considered a valid copy is subjective because of different requirements and use-cases. The benchmarks quoted below are based on use of WeakSet. By default, a cache based on WeakSet is used, but if WeakSet is not available then a fallback is used. The following object types are copied directly, as they are either primitives, cannot be cloned, or the common use-case implementation does not expect cloning:Ĭircular objects are supported out of the box.

  • String primitive wrappers (e.g., new String('foo')).
  • Number primitive wrappers (e.g., new Number(123)).
  • Boolean primitive wrappers (e.g., new Boolean(true)).
  • The following object types are deeply cloned when they are either properties on the object passed, or the object itself:
  • object => Object, or any custom constructor.
  • error => Error, AggregateError, EvalError, RangeError, ReferenceError, Synta圎rror, TypeError, URIError.
  • arrayBuffer=> ArrayBuffer, Float32Array, Float64Array, Int8Array, Int16Array, Int32Array, Uint8Array, Uint8ClampedArray, Uint16Array, Uint32Array, Uint64Array.
  • NOTE: This method is significantly slower than copy, so it is recommended to only use this when you have specific use-cases that require it. Set: (set) => createStrictClone(set, new Set(set.values())),

    fastcopy diff meaning

    import copy from 'fast-copy' Ĭonst copied = copy(), Generator objects are copied, but still reference the original generator's stateĬonsole.log(copiedObject = object) // falseĬonsole.log(deepEqual(copiedObject, object)) // true API copyĭeeply copy the object passed.The constructor of the original object is used, instead of using known globals.Error references are copied directly, instead of creating a new *Error object.A blazing fast deep object copier Table of contents















    Fastcopy diff meaning