Skip to content
Please note that GitHub no longer supports Internet Explorer.

We recommend upgrading to the latest Microsoft Edge, Google Chrome, or Firefox.

Learn more
Tiny deep clone utility for JavaScript that works only with basic types.
JavaScript
Branch: master
Clone or download
Paulus Schoutsen
Paulus Schoutsen 1.1.1: Add CJS build
Latest commit cedc8e0 Jun 30, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE.md Create LICENSE.md Jun 29, 2017
README.md
index.cjs.js 1.1.1: Add CJS build Jun 30, 2017
index.js Add support for Date Jun 29, 2017
package.json 1.1.1: Add CJS build Jun 30, 2017
test.js
yarn.lock

README.md

Deep clone simple

Deep clone utlity function for JavaScript that is limited to basic data types:

  • Objects { hello: 2 }
  • Array [1, 2, 3]
  • Number 5.2
  • Boolean true
  • String "hello"
  • Date new Date()
  • Functions function bla() {}
  • null

Minimizes to 279 bytes.

Only works with modern bundlers that support the module entry point like Rollup, Webpack 2+.

Installation

yarn add deep-clone-simple

Usage

import deepClone from 'deep-clone-simple';

const copy = deepClone(someData);

Run tests

yarn test
yarn test-watch
You can’t perform that action at this time.