Gathering detailed insights and metrics for proxy-clone
Gathering detailed insights and metrics for proxy-clone
npm install proxy-clone
Typescript
Module System
Node Version
NPM Version
70
Supply Chain
93.5
Quality
75.1
Maintenance
100
Vulnerability
99.6
License
JavaScript (100%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
8,791
Last Day
1
Last Week
3
Last Month
38
Last Year
381
129 Stars
68 Commits
14 Forks
5 Watchers
9 Branches
2 Contributors
Updated on Jul 02, 2024
Minified
Minified + Gzipped
Latest Version
1.0.3
Package Id
proxy-clone@1.0.3
Unpacked Size
10.05 kB
Size
3.44 kB
File Count
7
NPM Version
6.11.3
Node Version
10.17.0
Cumulative downloads
Total Downloads
Last Day
-50%
1
Compared to previous day
Last Week
-76.9%
3
Compared to previous week
Last Month
245.5%
38
Compared to previous month
Last Year
-33.9%
381
Compared to previous year
ES6 Proxies based deep clone, that's way more efficient than the traditional clone implementations when dealing with big objects.
Requires node 6 or later.
Note: This is not a traditional clone(). Changes to the source object will be reflected in the clone, changes to the clone however won't modify the source.
Depending on the object size, proxy-clone
can be a lot faster than naive JSON clone or the clone module from npm. The most important thing to note is that clone speed is constant, however using the cloned object is slightly slower.
JSON small x 60,036 ops/sec ±1.09% (92 runs sampled)
JSON medium x 5,919 ops/sec ±0.86% (91 runs sampled)
JSON big x 526 ops/sec ±1.20% (89 runs sampled)
JSON gigantic x 39.50 ops/sec ±1.83% (54 runs sampled)
clone small x 50,288 ops/sec ±1.20% (91 runs sampled)
clone medium x 4,381 ops/sec ±1.03% (90 runs sampled)
clone big x 230 ops/sec ±0.85% (85 runs sampled)
clone gigantic x 4.14 ops/sec ±1.54% (15 runs sampled)
proxy-clone small x 842,147 ops/sec ±1.18% (93 runs sampled)
proxy-clone medium x 891,579 ops/sec ±1.49% (87 runs sampled)
proxy-clone big x 814,796 ops/sec ±0.83% (92 runs sampled)
proxy-clone gigantic x 792,461 ops/sec ±0.79% (89 runs sampled)
1$ npm install proxy-clone
This module makes certain assumptions about what you do with the cloned object, and I only tested it with the operations one project required. If something behaves odly, open an issue and I'll look into it.
The api is what you'd expect:
1var clone = require('proxy-clone'); 2var assert = require('assert'); 3 4var obj = { 5 foo: { 6 bar: 'baz' 7 } 8}; 9 10var cloned = clone(obj); 11assert.deepEqual(cloned, obj);
Return a deep clone of obj
.
Traditional clone implementations recursively iterate over the object and copy all the properties to a new object, which can be slow. This module instead creates an ES6 Proxy. When you change a property on the proxy, it adds it to an internal change log. When you read from the proxy, it first checks for overrides, otherwise returns the original value from the object.
Thanks to @segmentio for letting me publish this private module that I developed while working for them.
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 1/15 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
20 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-02-10
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