Skip to content

LinusU/stringify-clone

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stringify Clone version License

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

Build Status Downloads Code Climate Coverage Status Dependency Status Dependencies

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 --only=production --save stringify-clone

API

clone()

const clone = require('stringify-clone')

clone({
  foo: 'bar'
})

©️ ahmadnassri.com  ·  License: ISC  ·  Github: @ahmadnassri  ·  Twitter: @ahmadnassri

About

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

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • JavaScript 100.0%