Socket
Socket
Sign inDemoInstall

es5-ext

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

es5-ext - npm Package Compare versions

Comparing version 0.10.33 to 0.10.34

10

CHANGELOG.md

@@ -5,2 +5,12 @@ # Change Log

<a name="0.10.34"></a>
## [0.10.34](https://github.com/medikoo/es5-ext/compare/v0.10.33...v0.10.34) (2017-10-13)
### Features
* **copyDeep:** duplicate only recursive instances ([bba529a](https://github.com/medikoo/es5-ext/commit/bba529a))
<a name="0.10.33"></a>

@@ -7,0 +17,0 @@ ## [0.10.33](https://github.com/medikoo/es5-ext/compare/v0.10.32...v0.10.33) (2017-10-13)

51

object/copy-deep.js

@@ -6,32 +6,29 @@ "use strict";

, ensureValue = require("./valid-value")
, isArray = Array.isArray
, copy
, copyItem;
, isArray = Array.isArray;
copyItem = function (value) {
var index;
if (!isPlainObject(value) && !isArray(value)) return value;
index = this[0].indexOf(value);
if (index === -1) return copy.call(this, value);
return this[1][index];
};
var copyValue = function (value, ancestors, ancestorsCopy) {
var mode;
if (isPlainObject(value)) mode = "object";
else if (isArray(value)) mode = "array";
if (!mode) return value;
copy = function (source) {
var target = isArray(source) ? [] : {};
this[0].push(source);
this[1].push(target);
if (isArray(source)) {
source.forEach(function (value, key) {
target[key] = copyItem.call(this, value, key);
}, this);
var copy = ancestorsCopy[ancestors.indexOf(value)];
if (copy) return copy;
copy = mode === "object" ? {} : [];
ancestors.push(value);
ancestorsCopy.push(copy);
if (mode === "object") {
forEach(value, function (item, key) {
copy[key] = copyValue(item, ancestors, ancestorsCopy);
});
} else {
forEach(
source,
function (value, key) {
target[key] = copyItem.call(this, value, key);
},
this
);
value.forEach(function (item, index) {
copy[index] = copyValue(item, ancestors, ancestorsCopy);
});
}
return target;
ancestors.pop();
ancestorsCopy.pop();
return copy;
};

@@ -42,3 +39,3 @@

if (obj !== source) return obj;
return copy.call([[], []], obj);
return copyValue(obj, [], []);
};
{
"name": "es5-ext",
"version": "0.10.33",
"version": "0.10.34",
"description": "ECMAScript extensions and shims",

@@ -5,0 +5,0 @@ "author": "Mariusz Nowak <medyk@medikoo.com> (http://www.medikoo.com/)",

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