
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
deep-copy-all
Advanced tools
deep-copy-alldeep-copy-all JavaScript object deep cloner is:
fast – ranking highly on common benchmark speed tests
compact – about 5k (minified)
robust – correctly handling all standard JavaScript data types, as well as custom types
$ npm install deep-copy-all
Node.js
const deepCopy = require('deep-copy-all');
/* ... */
copy = deepCopy(source);
HTML file:
<script src="dist/deepCopyAll.browser.js"></script>
<script>
/* ... */
let copy = deepCopy(source);
</script>
The accuracy of deep-copy-all compares well against other deep copying packages.
Legend: ☑️ - deep copy 🚧 - shallow copy 🗑️ - data loss ⚠️ - Error
| data type | JSON.* | ce | d-c | dc | cl | f-c | deep-copy-all |
|---|---|---|---|---|---|---|---|
| Array | ☑️ | ☑️ | ☑️ | ☑️ | ☑️ | ☑️ | ☑️ |
| ArrayBuffer | 🗑️ | 🗑️ | 🗑️ | ☑️ | 🗑️ | ☑️ | ☑️ |
| BigInt | ⚠️ | ☑️ | ☑️ | ☑️ | ☑️ | ☑️ | ☑️ |
| BigInt64Array | ⚠️ | 🗑️ | 🗑️ | 🚧 | ☑️ | ☑️ | ☑️ |
| BigUint64Array | ⚠️ | 🗑️ | 🗑️ | 🚧 | ☑️ | ☑️ | ☑️ |
| Buffer | 🗑️ | 🗑️ | 🗑️ | ☑️ | ☑️ | ☑️ | ☑️ |
| Date | 🗑️ | ☑️ | ☑️ | ☑️ | ☑️ | ☑️ | ☑️ |
| Error | 🗑️ | 🗑️ | 🗑️ | 🚧 | ☑️ | 🚧 | ☑️ |
| Float32Array | 🗑️ | 🗑️ | 🗑️ | ☑️ | ☑️ | ☑️ | ☑️ |
| Float64Array | 🗑️ | 🗑️ | 🗑️ | ☑️ | ☑️ | ☑️ | ☑️ |
| Int8Array | 🗑️ | 🗑️ | 🗑️ | ☑️ | ☑️ | ☑️ | ☑️ |
| Int8Array | 🗑️ | 🗑️ | 🗑️ | ☑️ | ☑️ | ☑️ | ☑️ |
| Int32Array | 🗑️ | 🗑️ | 🗑️ | ☑️ | ☑️ | ☑️ | ☑️ |
| Map | 🗑️ | 🗑️ | 🗑️ | ☑️ | ☑️ | ☑️ | ☑️ |
| Object | ☑️ | ☑️ | ☑️ | ☑️ | ☑️ | ☑️ | ☑️ |
| RegExp | 🗑️ | 🗑️ | 🗑️ | ☑️ | ☑️ | ☑️ | ☑️ |
| Set | 🗑️ | 🗑️ | 🗑️ | ☑️ | ☑️ | ☑️ | ☑️ |
| Uint8Array | 🗑️ | 🗑️ | 🗑️ | ☑️ | ☑️ | ☑️ | ☑️ |
| Uint8ClampedArray | 🗑️ | 🗑️ | 🗑️ | ☑️ | ☑️ | ☑️ | ☑️ |
| Uint16Array | 🗑️ | 🗑️ | 🗑️ | ☑️ | ☑️ | ☑️ | ☑️ |
| Uint32Array | 🗑️ | 🗑️ | 🗑️ | ☑️ | ☑️ | ☑️ | ☑️ |
| WeakMap | 🗑️ | 🗑️ | 🗑️ | 🚧 | ⚠️ | 🚧 | 🚧 |
| WeakSet | 🗑️ | 🗑️ | 🗑️ | 🚧 | ⚠️ | 🚧 | 🚧 |
| enumerable:false | 🗑️ | 🗑️ | 🗑️ | 🗑️ | 🗑️ | 🗑️ | ☑️ |
| custom Array | 🗑️ | 🗑️ | 🗑️ | 🗑️ | 🗑️ | ☑️ | ☑️ |
| custom Object | 🗑️ | 🗑️ | 🗑️ | 🗑️ | ☑️ | ☑️ | ☑️ |
| circular Object | ⚠️ | ☑️ | ⚠️ | ☑️ | ☑️ | 🗑️ | ☑️ |
JSON.* - JSON.parse(JSON.stringify())
ce - cloneextend
d-c - deep-copy
dc - deepcopy
cl - clone
f-c - fast-copy
deepCopy()Perform deep copy of a JavaScript object or array.
deepCopy(source [, options])
source
The item to copy.
options
{Object} [optional] - Modifies copying behavior.
options properties:
goDeep
{Boolean} [optional] - Perform deep copy if true (default).
Set to false to perform shallow copy.
includeNonEnumerable
{Boolean} [optional] - Copies non-enumerable properties if true.
Skips non-enumerable properties if false (default).
detectCircular
{Boolean} [optional] - Detect circular references if true (default).
May be set to false if source has no circular references.
maxDepth
{number} [optional] - The maximum depth to copy, default is 20 levels.
The copied data.
The following data types — passed directly to deepCopy or embedded within another object — have been verified to be copied correctly:
ArrayArrayBufferBuffer (node.js)DateErrorRegExpInt8ArrayUint8ArrayUint8ClampedArrayInt16ArrayUint16ArrayInt32ArrayUint32ArrayFloat32ArrayFloat64ArrayBigInt64ArrayBigUint64ArrayMapSetObjectPrimtive data types are not deep copied. Instead, their values are copied:
NumberStringBooleanundefinedBigIntSymbolnullThe following object types are not deep copied, as no way has been found to copy them. They are copied by reference only:
FunctionWeakMapWeakSetIn a standard benchmark test of 14 commonly used deep copy modules, deep-copy-all was 4th fastest.
FAQs
deep copy JavaScript data of any type
The npm package deep-copy-all receives a total of 2,619 weekly downloads. As such, deep-copy-all popularity was classified as popular.
We found that deep-copy-all demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.