@ianwalter/clone
v6.0.1
Published
A configurable utility to clone JavaScript data (Objects, Arrays, etc)
Downloads
2,643
Maintainers
Readme
@ianwalter/clone
A configurable utility to clone JavaScript data (Objects, Arrays, etc)
About
I created clone because I wanted to use the terrific nanoclone utility but not have the source Object's prototype properties be copied.
The difference, for my purposes, is to be able to clone an Object without cloning it's getters and setters. The state management library Vuex uses Object getters and setters for it's "reactive" functionality and there are times when you might want to extract and mutate data from the store without those mutations affecting the original data in the store.
Installation
yarn add @ianwalter/clone
Usage
import clone from '@ianwalter/clone'
const clonedBook = clone(book)
License
Apache 2.0 with Commons Clause - See LICENSE
Created by Ian Walter