https://github.com/knaxus/deep-copy-js
A JavaScript utility for deep copy
https://github.com/knaxus/deep-copy-js
javascript javascript-library javascript-plugin
Last synced: 10 months ago
JSON representation
A JavaScript utility for deep copy
- Host: GitHub
- URL: https://github.com/knaxus/deep-copy-js
- Owner: knaxus
- Created: 2020-04-22T05:22:47.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T06:47:04.000Z (almost 3 years ago)
- Last Synced: 2025-01-22T01:28:10.674Z (11 months ago)
- Topics: javascript, javascript-library, javascript-plugin
- Language: JavaScript
- Size: 616 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# deep-copy-js
Deep copy implementation for pactice.
## Usage
```javascript
(() => {
console.log('Deep Clone in action');
console.log('deepClone(10) ==>', deepClone(10));
console.log('deepClone([1, true, "hello"]) ==>', deepClone([1, true, "hello"]));
console.log('deepClone({ name: "John", age: 10}) ==>', deepClone({ name: "John", age: 10 }));
console.log('deepClone({ name: "John", address: { city: "LA" }}) ==>', deepClone({ name: "John", address: { city: "Delhi" } }));
})();
```
### Using a shortcut
```javascript
const clone = JSON.parse(JSON.stringify(data));
```