Gathering detailed insights and metrics for @visulima/deep-clone
Gathering detailed insights and metrics for @visulima/deep-clone
Gathering detailed insights and metrics for @visulima/deep-clone
Gathering detailed insights and metrics for @visulima/deep-clone
@ffras4vnpm/enim-recusandae-assumenda
<p align="center"> <a href="https://visulima.com"> <picture> <source media="(prefers-color-scheme: dark)" srcset=""> <img src="" height="128"> </picture> <h1 align="center">Visulima</h1> </a> </p>
@wemnyelezxnpm/nisi-sunt-vero
<p align="center"> <a href="https://visulima.com"> <picture> <source media="(prefers-color-scheme: dark)" srcset=""> <img src="" height="128"> </picture> <h1 align="center">Visulima</h1> </a> </p>
@micromint1npm/voluptate-incidunt-occaecati
<p align="center"> <a href="https://visulima.com"> <picture> <source media="(prefers-color-scheme: dark)" srcset=""> <img src="" height="128"> </picture> <h1 align="center">Visulima</h1> </a> </p>
npm install @visulima/deep-clone
Typescript
Module System
Min. Node Version
Node Version
NPM Version
69.2
Supply Chain
94.4
Quality
86.4
Maintenance
100
Vulnerability
100
License
@visulima/package@3.2.0
Published on 16 Dec 2024
@visulima/cerebro@1.1.26
Published on 12 Dec 2024
@visulima/pail@2.1.12
Published on 12 Dec 2024
@visulima/api-platform@3.0.27
Published on 12 Dec 2024
@visulima/jsdoc-open-api@2.0.65
Published on 12 Dec 2024
@visulima/find-cache-dir@1.0.16
Published on 12 Dec 2024
TypeScript (91.8%)
JavaScript (5.89%)
MDX (1.66%)
Handlebars (0.39%)
CSS (0.14%)
Shell (0.12%)
Total Downloads
3,644
Last Day
3
Last Week
47
Last Month
468
Last Year
2,969
12 Stars
2,205 Commits
3 Forks
2 Watching
16 Branches
2 Contributors
Latest Version
2.1.7
Package Id
@visulima/deep-clone@2.1.7
Unpacked Size
54.68 kB
Size
15.65 kB
File Count
46
NPM Version
9.6.7
Node Version
18.20.5
Publised On
12 Dec 2024
Cumulative downloads
Total Downloads
Last day
-88.9%
3
Compared to previous day
Last week
-75.9%
47
Compared to previous week
Last month
-18.3%
468
Compared to previous month
Last year
339.9%
2,969
Compared to previous year
41
Really Fast Deep Clone.
Daniel Bannert's open source work is supported by the community on GitHub Sponsors
1npm install @visulima/deep-clone
1yarn add @visulima/deep-clone
1pnpm add @visulima/deep-clone
Copy or deep clone an input value to an arbitrary depth. The function accepts both objects and primitives.
1import deepClone from "@visulima/deep-clone"; 2 3const cloned = deepClone({ a: 1, b: { c: 2 } }); 4 5console.log(cloned); // => {a: 1, b: {c: 2}}
Type: any
The input value to copy.
Type: object
Type: boolean
Default: false
If true
, it will copy all properties, including non-enumerable ones and symbols.
Type: object
A set of custom handlers for specific type of value. Each handler is a function that takes the original value and returns a new value or throws an error if the value is not supported.
Copy all properties contained on the object.
1import { copyOwnProperties } from "@visulima/deep-clone/utils"; 2 3const obj = { a: 1, b: 2 }; 4 5const copy = copyOwnProperties(obj); 6 7console.log(copy); // => {a: 1, b: 2}
Get an empty version of the object with the same prototype it has.
1import { getCleanClone } from "@visulima/deep-clone/utils"; 2 3const obj = { a: 1, b: 2 }; 4 5const clean = getCleanClone(obj); 6 7console.log(clean); // => {}
List of supported values/types:
undefined
(original value is returned)null
(original value is returned)boolean
/Boolean
(original value is returned)string
/String
(original value is returned)number
/Number
(original value is returned)function
Object
Date
RegExp
Set
Map
Error
URIError
ReferenceError
SyntaxError
RangeError
EvalError
TypeError
System Error
(Node.js)Array
Int8Array
Uint8Array
Uint8ClampedArray
Init16Array
Uint16Array
Int32Array
Uint32Array
Float32Array
Float64Array
Buffer
(Node.js)DataView
Blob
List of unsupported values/types:
DOMElement
: to copy DOM elements, use element.cloneNode()
.Symbol
WeakMap
WeakSet
File
FileList
ImageData
ImageBitmap
Promise
SharedArrayBuffer
The implementation can handle circular references.
If a Number
, String
, or Boolean
object is encountered, the value is cloned as a primitive. This behavior is intentional. The implementation is opinionated in wanting to avoid creating numbers
, strings
, and booleans
via the new
operator and a constructor.
The implementation only checks whether basic Objects
, Arrays
, and class instances are extensible
, sealed
, and/or frozen
.
functions
are not cloned; their reference is copied.
The implementation supports custom error
types which are Error
instances (e.g., ES2015 subclasses).
Note:
It is true that jsondiffpatch.clone()
from jsondiffpatch is faster than @visulima/deep-clonse
in this particular benchmark, but it cannot handle as many situations as @visulima/deep-clonse
can.
It is true that fastest-json-copy is faster than @visulima/deep-clonse
in this particular benchmark. Also, fastest-json-copy has such huge limitations that it is rarely useful. For example, it treats things like Date
and Map
instances the same as empty {}
. It can't handle circular references.
plain-object-clone is also really limited in capability.
Libraries in this ecosystem make the best effort to track Node.js’ release schedule. Here’s a post on why we think this is important.
If you would like to help take a look at the list of issues and check our Contributing guild.
Note: please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
The visulima deep-clone is open-sourced software licensed under the MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
project has 6 contributing companies or organizations
Details
Reason
no dangerous workflow patterns detected
Reason
update tool detected
Details
Reason
license file detected
Details
Reason
30 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 10
Reason
SAST tool detected: CodeQL
Details
Reason
dependency not pinned by hash detected -- score normalized to 8
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Score
Last Scanned on 2024-12-24T07:27:21Z
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More