- #110 - Fix legacy types not aligning with types from build package
- The default
copymethod is now a named export, and the default export has been removed. - Legacy environment support has been removed;
Symbol,WeakMap, andRegExp.prototype.flagsare now expected to be present. createCopiernow receives an object of options. The methods passed previously are namespaced under themethodskey in that options object.createStrictCopierhas been removed; please use thestrictoption passed tocreateCopier
- #95 - Add support for objects that have a prototype with no constructor
Breaking changes
- Exports are now always named, so the
.defaultsuffix is required when accessing- CommonJS in Node =>
const copy = require('fast-copy').default; - UMD global via CDN =>
const copy = globalThis['fast-copy'].default;
- CommonJS in Node =>
copy.strictis no longer available; it is now available as the explicitcopyStrictnamed import- Options have been removed
isStrictoption has been replaced with importing the separatecopyStrictmethodrealmhas been removed entirely, asinstanceofis no longer used internally
- The
FastCopynamespace in typings has been removed in favor of explicit import of available types
Enhancements
- Support
exportsoption, to have bettern handling for different environments (ESM vs CJS vs UMD) and improve tree-shaking when supported - Can now create a custom copier (either standard or strict), allowing maximum performance for specific use-cases
- Small speed improvements when handling certain object types
Bug fixes
- Correctly handle primitive wrappers, e.g.
new String('foo')
- Republish of
2.1.6, as the release process failed mid-publish
- Revert #69 and #71, as they broke the package for NodeJS consumption (will be reintroduced in v3, as breaking changes are required)
- Ensure
"type": "module"is set to allow ESM in NodeJS to work #71
- Fix source maps not referencing source code #65
- Support
constructorproperty override on object #60 - Provide better support for
constructoroverride on non-plain object types #61 - Remove
tslintin favor of@typescript-eslint#62
- Fix ESM-to-CommonJS issue when using TSC to consume #37
- Modify
Blobcloning to useblob.slice()instead ofnew Blob()for speed
- Support cloning
Blob#31 (thanks @fratzigner) - Fix cloning descriptors that only are getters / setters in strict mode
- Handle errors when defining properties in strict mode
- Cache length of arrays for faster iteration #22
- Update dev dependencies and types
- Add safety to constructing native objects (fixes #19)
- Manually coalesce options instead of use destructuring (performance)
- Fix typings declarations - #17
- Rewrite in TypeScript
- Add strict mode (for more accurate and thorough copying, at the expense of less performance)
- Second parameter is now an object of options
- Ensure
Datecopy uses realm-specific constructor
- Support custom prototype applied to plain object via
Object.create()
- Support copy of extensions of native
Arraywith alternativepush()method
- Under-the-hood optimizations per recommendations from #7
- Add support for multiple realms
- Optimize order of operations for common use cases
- Fix cache using
WeakSetwhen there was support forWeakMaps instead ofWeakSets (in case one was polyfilled but not the other)
- Add TypeScript and FlowType bindings
- Activate tree-shaking
- Initial release