Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fabiospampinato/duper
Standalone functions for creating shallow clones or deep clones.
https://github.com/fabiospampinato/duper
clone deep shallow
Last synced: 20 days ago
JSON representation
Standalone functions for creating shallow clones or deep clones.
- Host: GitHub
- URL: https://github.com/fabiospampinato/duper
- Owner: fabiospampinato
- License: mit
- Created: 2022-11-05T23:24:58.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2023-09-24T16:37:51.000Z (about 1 year ago)
- Last Synced: 2024-10-14T12:21:28.003Z (2 months ago)
- Topics: clone, deep, shallow
- Language: JavaScript
- Homepage:
- Size: 12.7 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# Duper
Standalone functions for creating shallow clones or deep clones.
It supports cloning primitives, `Array`, `Map`, `Set`, `Date`, `RegExp`, `ArrayBuffer`, `DataView`, `Int8Array`, `Uint8Array`, `Uint8ClampedArray`, `Int16Array`, `Uint16Array`, `Int32Array`, `Uint32Array`, `Float32Array`, `Float64Array`, `BigInt64Array`, `BigUint64Array`, `Error`, `EvalError`, `RangeError`, `ReferenceError`, `SyntaxError`, `TypeError`, `URIError`, and plain objects, trying to clone anything else will throw.
## Install
```sh
npm install --save duper
```## Usage
```ts
import {cloneShallow, cloneDeep} from 'duper';cloneShallow ({ foo: { value: 123 } }); // => Shallow clone of the object
cloneDeep ({ foo: { value: 123 } }); // => Deep clone of the object
```## License
MIT © Fabio Spampinato