Installations
npm install proxy-clone
Developer Guide
Typescript
No
Module System
N/A
Node Version
10.17.0
NPM Version
6.11.3
Score
70
Supply Chain
93.5
Quality
75.1
Maintenance
100
Vulnerability
99.6
License
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
juliangruber
Download Statistics
Total Downloads
8,791
Last Day
1
Last Week
3
Last Month
38
Last Year
381
GitHub Statistics
129 Stars
68 Commits
14 Forks
5 Watchers
9 Branches
2 Contributors
Updated on Jul 02, 2024
Bundle Size
7.50 kB
Minified
2.90 kB
Minified + Gzipped
Package Meta Information
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
Total Downloads
Cumulative downloads
Total Downloads
8,791
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
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
proxy-clone 
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.
Performance
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)
Installation
1$ npm install proxy-clone
Stability
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.
Example
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);
API
clone(obj)
Return a deep clone of obj
.
How it works
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.
Kudos
Thanks to @segmentio for letting me publish this private module that I developed while working for them.
License
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
- Warn: no fuzzer integrations found
Reason
license file not detected
Details
- Warn: project does not have a license file
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 16 are checked with a SAST tool
Reason
20 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-h6ch-v84p-w6p9
- Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6
- Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97
- Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j
- Warn: Project is vulnerable to: GHSA-896r-f27r-55mw
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v
- Warn: Project is vulnerable to: GHSA-v4rh-8p82-6h5w
- Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp
Score
1.3
/10
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