stringify-clone
v3.0.2
Published
Wrapper for fast object cloning using `JSON.parse` & `JSON.stringify`
Downloads
407,647
Readme
Stringify Clone
Wrapper for fast object cloning using JSON.parse
& JSON.stringify
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 tonull
Date
objects will be converted to ISO strings (equivalent of runningDate.toISOString()
)- you can reconstruct the Date by calling
new Date(string)
- you can reconstruct the Date by calling
Install
npm install stringify-clone
Usage
API
clone()
const clone = require('stringify-clone')
clone({
foo: 'bar'
})
Author: Ahmad Nassri • Twitter: @AhmadNassri