1.3.0 • Published 10 months ago

@crunkstar/fclone v1.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

FClone

Original FClone reverses object key order, this repo "fixes" this behaviour Also adds support for MongoDB ObjectIds (https://www.npmjs.com/package/objectid)

Clone objects by dropping circular references

This module clones a Javascript object in safe mode (eg: drops circular values) recursively. Circular values are replaced with a string: '[Circular]'.

Installation

npm install @crunkstar/fclone
# or
bower install @crunkstar/fclone

Usage

const fclone = require('@crunkstar/fclone');

let a = {c: 'hello'};
a.b = a;

let o = fclone(a);

console.log(o);
// outputs: { c: 'hello', b: '[Circular]' }

//JSON.stringify is now safe
console.log(JSON.stringify(o));
1.3.0

10 months ago

1.2.0

12 months ago

1.1.0

3 years ago