Socket
Socket
Sign inDemoInstall

clone

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clone - npm Package Compare versions

Comparing version 0.1.13 to 0.1.14

22

clone.js

@@ -1,4 +0,4 @@

"use strict";
'use strict';
var util = require("util");
var util = require('util');

@@ -38,3 +38,2 @@ function objectToString(o) {

function clone(parent, circular, depth) {
// maintain two arrays for circular references, where corresponding parents

@@ -55,2 +54,5 @@ // and children have the same index

function _clone(parent, depth) {
// cloning null always returns null
if (parent === null)
return null;

@@ -64,11 +66,11 @@ if (depth == 0)

}
if (util.isArray(parent))
if (util.isArray(parent)) {
child = [];
else if (util.isRegExp(parent)) {
} else if (util.isRegExp(parent)) {
child = new RegExp(parent.source, getRegExpFlags(parent));
if (parent.lastIndex) child.lastIndex = parent.lastIndex;
}
else if (util.isDate(parent))
} else if (util.isDate(parent)) {
child = new Date(parent.getTime());
else if (useBuffer && Buffer.isBuffer(parent)) {
} else if (useBuffer && Buffer.isBuffer(parent)) {
child = new Buffer(parent.length);

@@ -79,2 +81,3 @@ parent.copy(child);

}
if (circular) {

@@ -89,7 +92,10 @@ var index = allParents.indexOf(parent);

}
for (var i in parent) {
child[i] = _clone(parent[i], depth - 1);
}
return child;
}
return _clone(parent, depth);

@@ -96,0 +102,0 @@ }

@@ -11,3 +11,3 @@ {

],
"version": "0.1.13",
"version": "0.1.14",
"repository": {

@@ -14,0 +14,0 @@ "type": "git",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc