stringify-clone

3.0.2 • Public • Published

Stringify Clone

Wrapper for fast object cloning using JSON.parse & JSON.stringify

license release semantic

IMPORTANT:

THIS IS A ONE LINE PACKAGE, THERE IS NO REASON FOR YOU TO USE IT!

Notes:

  • cannot clone RegExp (returns {})
  • NaN values will be converted to null
  • Date objects will be converted to ISO strings (equivalent of running Date.toISOString())
    • you can reconstruct the Date by calling new Date(string)

Install

npm install stringify-clone

Usage

API

clone()

const clone = require('stringify-clone')

clone({
  foo: 'bar'
})

Author: Ahmad Nassri • Twitter: @AhmadNassri

Readme

Keywords

Package Sidebar

Install

npm i stringify-clone

Weekly Downloads

70,611

Version

3.0.2

License

MIT

Unpacked Size

3.48 kB

Total Files

4

Last publish

Collaborators

  • ahmadnassri