@ianwalter/clone

6.0.1 • Public • Published

@ianwalter/clone

A configurable utility to clone JavaScript data (Objects, Arrays, etc)

npm page CI

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

Package Sidebar

Install

npm i @ianwalter/clone

Weekly Downloads

347

Version

6.0.1

License

SEE LICENSE IN LICENSE

Unpacked Size

6.49 kB

Total Files

7

Last publish

Collaborators

  • ianwalter