- #95 - Add support for objects that have a prototype with no constructor
Breaking changes
- Exports are now always named, so the
.default
suffix 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.strict
is no longer available; it is now available as the explicitcopyStrict
named import- Options have been removed
isStrict
option has been replaced with importing the separatecopyStrict
methodrealm
has been removed entirely, asinstanceof
is no longer used internally
- The
FastCopy
namespace in typings has been removed in favor of explicit import of available types
Enhancements
- Support
exports
option, 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
constructor
property override on object #60 - Provide better support for
constructor
override on non-plain object types #61 - Remove
tslint
in favor of@typescript-eslint
#62
- Fix ESM-to-CommonJS issue when using TSC to consume #37
- Modify
Blob
cloning 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
Date
copy uses realm-specific constructor
- Support custom prototype applied to plain object via
Object.create()
- Support copy of extensions of native
Array
with 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
WeakSet
when there was support forWeakMap
s instead ofWeakSet
s (in case one was polyfilled but not the other)
- Add TypeScript and FlowType bindings
- Activate tree-shaking
- Initial release