Comparing version 1.0.1 to 1.0.2
@@ -18,3 +18,3 @@ 'use strict' | ||
const soyuka_clone = require('../dist/clone.js') | ||
const soyuka_clone = require('../dist/fclone.js') | ||
const clone = require('clone') | ||
@@ -27,6 +27,6 @@ const deepcopy = require('deepcopy') | ||
suite | ||
.add('@soyuka/clone', function() { | ||
.add('fclone', function() { | ||
let b = soyuka_clone(a) | ||
}) | ||
.add('@soyuka/clone + json.stringify', function() { | ||
.add('fclone + json.stringify', function() { | ||
let b = JSON.stringify(soyuka_clone(a)) | ||
@@ -33,0 +33,0 @@ }) |
@@ -55,3 +55,3 @@ (function (root, factory) { | ||
copy.stack = obj.stack; | ||
refs.length--; | ||
refs.length && refs.length--; | ||
return copy; | ||
@@ -58,0 +58,0 @@ } |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"function"==typeof define&&define.amd?define("fclone",[],n):"object"==typeof module&&module.exports?module.exports=n():e.fclone=n()}(this,function(){"use strict";function e(t,r){if(!t||"object"!==("undefined"==typeof t?"undefined":n(t)))return t;if(t instanceof Date){var f=new Date;return f.setTime(t.getTime()),f}if(void 0!==Buffer&&Buffer.isBuffer(t))return new Buffer(t);if(r||(r=[]),Array.isArray(t)){r[r.length]=t;for(var o=t.length,i=-1,u=[];o>++i;)u[i]=~r.indexOf(t[i])?"[Circular]":e(t[i],r);return r.length&&r.length--,u}r[r.length]=t;var a={};if(t instanceof Error)return a.name=t.name,a.message=t.message,a.stack=t.stack,r.length--,a;for(var c=Object.keys(t),l=c.length;l--;){var s=c[l];a[s]=~r.indexOf(t[s])?"[Circular]":e(t[s],r)}return r.length&&r.length--,a}var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};return e}); | ||
!function(e,n){"function"==typeof define&&define.amd?define("fclone",[],n):"object"==typeof module&&module.exports?module.exports=n():e.fclone=n()}(this,function(){"use strict";function e(t,r){if(!t||"object"!==("undefined"==typeof t?"undefined":n(t)))return t;if(t instanceof Date){var f=new Date;return f.setTime(t.getTime()),f}if(void 0!==Buffer&&Buffer.isBuffer(t))return new Buffer(t);if(r||(r=[]),Array.isArray(t)){r[r.length]=t;for(var o=t.length,i=-1,u=[];o>++i;)u[i]=~r.indexOf(t[i])?"[Circular]":e(t[i],r);return r.length&&r.length--,u}r[r.length]=t;var l={};if(t instanceof Error)return l.name=t.name,l.message=t.message,l.stack=t.stack,r.length&&r.length--,l;for(var a=Object.keys(t),c=a.length;c--;){var s=a[c];l[s]=~r.indexOf(t[s])?"[Circular]":e(t[s],r)}return r.length&&r.length--,l}var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};return e}); |
{ | ||
"name": "fclone", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Clone objects recursively by dropping circular references", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
# FClone | ||
[![Build Status](https://travis-ci.org/soyuka/clone.svg?branch=master)](https://travis-ci.org/soyuka/clone) | ||
[![Build Status](https://travis-ci.org/soyuka/fclone.svg?branch=master)](https://travis-ci.org/soyuka/fclone) | ||
@@ -38,9 +38,9 @@ This module clones a Javascript object in safe mode (eg: drops circular values) recursively. Circular values are replaced with a string: `'[Circular]'`. | ||
``` | ||
fclone x 13,891 ops/sec ±0.86% (88 runs sampled) | ||
fclone + json.stringify x 7,267 ops/sec ±3.26% (79 runs sampled) | ||
jsan x 4,458 ops/sec ±2.26% (87 runs sampled) | ||
circularjson x 4,075 ops/sec ±2.77% (85 runs sampled) | ||
deepcopy x 5,009 ops/sec ±4.59% (76 runs sampled) | ||
json-stringify-safe x 4,883 ops/sec ±2.62% (85 runs sampled) | ||
Fastest is @soyuka/clone | ||
fclone x 13,342 ops/sec ±3.83% (79 runs sampled) | ||
fclone + json.stringify x 7,311 ops/sec ±3.99% (77 runs sampled) | ||
jsan x 4,419 ops/sec ±3.11% (86 runs sampled) | ||
circularjson x 4,294 ops/sec ±0.82% (91 runs sampled) | ||
deepcopy x 5,298 ops/sec ±0.76% (83 runs sampled) | ||
json-stringify-safe x 5,201 ops/sec ±0.82% (84 runs sampled) | ||
Fastest is fclone | ||
``` |
@@ -39,3 +39,3 @@ 'use strict'; | ||
copy.stack = obj.stack; | ||
refs.length-- | ||
refs.length && refs.length-- | ||
return copy; | ||
@@ -42,0 +42,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11396