Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kelin2025/nanoclone
Tiny util to deep clone JavaScript objects
https://github.com/kelin2025/nanoclone
Last synced: 5 days ago
JSON representation
Tiny util to deep clone JavaScript objects
- Host: GitHub
- URL: https://github.com/kelin2025/nanoclone
- Owner: Kelin2025
- License: mit
- Created: 2017-11-24T00:12:09.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-05-11T01:22:09.000Z (almost 2 years ago)
- Last Synced: 2024-04-23T19:39:13.694Z (10 months ago)
- Language: JavaScript
- Homepage:
- Size: 289 KB
- Stars: 73
- Watchers: 3
- Forks: 10
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-javascript - nanoclone
- awesome-javascript - nanoclone
README
# nanoclone
[](https://github.com/kelin2025/nanoclone/blob/master/LICENSE)
[](https://npmjs.com/package/nanoclone)
Only **300B** to deep clone JavaScript objects## Is it small enough?
See the size of the most popular **[clone](https://www.npmjs.com/package/clone)** npm package with **250M+** downloads

And nanoclone size:
## Supported
- [x] Primitives
- [x] Arrays
- [x] Plain objects
- [x] DOM Nodes
- [x] Date instances
- [x] RegExp instances
- [x] Maps
- [x] Sets
- [x] Circular structures## Installation
```
yarn add nanoclone
npm install nanoclone
```## Usage
```javascript
import clone from 'nanoclone'let a = {
num: 2,
arr: [1, 2, 3],
nested: {
obj: {
a: 0
}
}
}let b = clone(a)
```## License
MIT