Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

deepcopy

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deepcopy - npm Package Compare versions

Comparing version 0.6.1 to 0.6.2

82

build/deepcopy.js

@@ -82,3 +82,3 @@ /*!

var getKeys = Object.keys ? function getKeys(obj) {
var getKeys = typeof Object.keys === 'function' ? function getKeys(obj) {
return Object.keys(obj);

@@ -88,3 +88,3 @@ } : function getKeys(obj) {

if (obj === null || objType !== 'function' || objType !== 'object') {
if (obj === null || objType !== 'function' && objType !== 'object') {
throw new TypeError('obj must be an Object');

@@ -94,6 +94,6 @@ }

var resultKeys = [],
key = undefined;
key = void 0;
for (key in obj) {
obj.hasOwnProperty(key) && resultKeys.push(key);
Object.prototype.hasOwnProperty.call(obj, key) && resultKeys.push(key);
}

@@ -122,5 +122,5 @@

var i = undefined,
len = undefined,
value = undefined;
var i = void 0,
len = void 0,
value = void 0;

@@ -130,6 +130,9 @@ for (i = 0, len = array.length; i < len; ++i) {

// it is SameValue algorithm
// http://stackoverflow.com/questions/27144277/comparing-a-variable-with-itself
// NOTE:
//
// it is SameValue algorithm
// http://stackoverflow.com/questions/27144277/comparing-a-variable-with-itself
//
// eslint-disable-next-line no-self-compare
if (value === s || value !== value && s !== s) {
// eslint-disable-line no-self-compare
return i;

@@ -142,9 +145,6 @@ }

exports['default'] = {
getKeys: getKeys,
getSymbols: getSymbols,
indexOf: indexOf,
isBuffer: isBuffer
};
module.exports = exports['default'];
exports.getKeys = getKeys;
exports.getSymbols = getSymbols;
exports.indexOf = indexOf;
exports.isBuffer = isBuffer;

@@ -158,2 +158,3 @@ /***/ },

exports.__esModule = true;
exports.copyValue = exports.copyCollection = exports.copy = void 0;

@@ -216,3 +217,3 @@ var _polyfill = __webpack_require__(1);

// user defined function
return new Function('return ' + source)();
return new Function('return ' + String(source))();
}

@@ -247,3 +248,3 @@ }

// +new Date(+date); // 1420909757913
return new Date(+target);
return new Date(target.getTime());
}

@@ -268,3 +269,3 @@

if (_polyfill.isBuffer(target)) {
if ((0, _polyfill.isBuffer)(target)) {
var buffer = new Buffer(target.length);

@@ -298,8 +299,5 @@

exports['default'] = {
copy: copy,
copyCollection: copyCollection,
copyValue: copyValue
};
module.exports = exports['default'];
exports.copy = copy;
exports.copyCollection = copyCollection;
exports.copyValue = copyValue;

@@ -323,3 +321,3 @@ /***/ },

function deepcopy(target) {
var customizer = arguments.length <= 1 || arguments[1] === undefined ? defaultCustomizer : arguments[1];
var customizer = arguments.length <= 1 || arguments[1] === void 0 ? defaultCustomizer : arguments[1];

@@ -331,3 +329,3 @@ if (target === null) {

var resultValue = _copy.copyValue(target);
var resultValue = (0, _copy.copyValue)(target);

@@ -339,3 +337,3 @@ if (resultValue !== null) {

var resultCollection = _copy.copyCollection(target, customizer),
var resultCollection = (0, _copy.copyCollection)(target, customizer),
clone = resultCollection !== null ? resultCollection : target;

@@ -356,3 +354,3 @@

var resultValue = _copy.copyValue(target);
var resultValue = (0, _copy.copyValue)(target);

@@ -364,13 +362,13 @@ if (resultValue !== null) {

var keys = _polyfill.getKeys(target).concat(_polyfill.getSymbols(target));
var keys = (0, _polyfill.getKeys)(target).concat((0, _polyfill.getSymbols)(target));
var i = undefined,
len = undefined;
var i = void 0,
len = void 0;
var key = undefined,
value = undefined,
index = undefined,
resultCopy = undefined,
result = undefined,
ref = undefined;
var key = void 0,
value = void 0,
index = void 0,
resultCopy = void 0,
result = void 0,
ref = void 0;

@@ -380,6 +378,6 @@ for (i = 0, len = keys.length; i < len; ++i) {

value = target[key];
index = _polyfill.indexOf(visited, value);
index = (0, _polyfill.indexOf)(visited, value);
if (index === -1) {
resultCopy = _copy.copy(value, customizer);
resultCopy = (0, _copy.copy)(value, customizer);
result = resultCopy !== null ? resultCopy : value;

@@ -390,2 +388,4 @@

reference.push(result);
} else {
ref = result;
}

@@ -392,0 +392,0 @@ } else {

@@ -6,2 +6,2 @@ /*!

*/
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.deepcopy=t():e.deepcopy=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";e.exports=n(3)},function(e,t){"use strict";function n(e,t){if("[object Array]"!==r.call(e))throw new TypeError("array must be an Array");var n=void 0,o=void 0,u=void 0;for(n=0,o=e.length;o>n;++n)if(u=e[n],u===t||u!==u&&t!==t)return n;return-1}t.__esModule=!0;var r=Object.prototype.toString,o="undefined"!=typeof Buffer?function(e){return Buffer.isBuffer(e)}:function(){return!1},u=Object.keys?function(e){return Object.keys(e)}:function(e){var t=typeof e;if(null===e||"function"!==t||"object"!==t)throw new TypeError("obj must be an Object");var n=[],r=void 0;for(r in e)e.hasOwnProperty(r)&&n.push(r);return n},i="function"==typeof Symbol?function(e){return Object.getOwnPropertySymbols(e)}:function(){return[]};t["default"]={getKeys:u,getSymbols:i,indexOf:n,isBuffer:o},e.exports=t["default"]},function(e,t,n){"use strict";function r(e,t){var n=u(e);return null!==n?u(e):o(e,t)}function o(e,t){if("function"!=typeof t)throw new TypeError("customizer is must be a Function");if("function"==typeof e){var n=String(e);return/^\s*function\s*\S*\([^\)]*\)\s*{\s*\[native code\]\s*}/.test(n)?e:new Function("return "+n)()}var r=f.call(e);if("[object Array]"===r)return[];if("[object Object]"===r&&e.constructor===Object)return{};if("[object Date]"===r)return new Date(+e);if("[object RegExp]"===r){var o=String(e),u=o.lastIndexOf("/");return new RegExp(o.slice(1,u),o.slice(u+1))}if(i.isBuffer(e)){var c=new Buffer(e.length);return e.copy(c),c}var l=t(e);return void 0!==l?l:null}function u(e){var t=typeof e;return null!==e&&"object"!==t&&"function"!==t?e:null}t.__esModule=!0;var i=n(1),f=Object.prototype.toString;t["default"]={copy:r,copyCollection:o,copyValue:u},e.exports=t["default"]},function(e,t,n){"use strict";function r(e){}function o(e){var t=arguments.length<=1||void 0===arguments[1]?r:arguments[1];if(null===e)return null;var n=i.copyValue(e);if(null!==n)return n;var o=i.copyCollection(e,t),f=null!==o?o:e,c=[e],l=[f];return u(e,t,f,c,l)}function u(e,t,n,r,o){if(null===e)return null;var c=i.copyValue(e);if(null!==c)return c;var l=f.getKeys(e).concat(f.getSymbols(e)),s=void 0,a=void 0,p=void 0,d=void 0,y=void 0,v=void 0,b=void 0,j=void 0;for(s=0,a=l.length;a>s;++s)p=l[s],d=e[p],y=f.indexOf(r,d),-1===y?(v=i.copy(d,t),b=null!==v?v:d,null!==d&&/^(?:function|object)$/.test(typeof d)&&(r.push(d),o.push(b))):j=o[y],n[p]=j||u(d,t,b,r,o);return n}t.__esModule=!0;var i=n(2),f=n(1);t["default"]=o,e.exports=t["default"]}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.deepcopy=e():t.deepcopy=e()}(this,function(){return function(t){function e(o){if(n[o])return n[o].exports;var r=n[o]={exports:{},id:o,loaded:!1};return t[o].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";t.exports=n(3)},function(t,e){"use strict";function n(t,e){if("[object Array]"!==o.call(t))throw new TypeError("array must be an Array");var n=void 0,r=void 0,u=void 0;for(n=0,r=t.length;r>n;++n)if(u=t[n],u===e||u!==u&&e!==e)return n;return-1}e.__esModule=!0;var o=Object.prototype.toString,r="undefined"!=typeof Buffer?function(t){return Buffer.isBuffer(t)}:function(){return!1},u="function"==typeof Object.keys?function(t){return Object.keys(t)}:function(t){var e=typeof t;if(null===t||"function"!==e&&"object"!==e)throw new TypeError("obj must be an Object");var n=[],o=void 0;for(o in t)Object.prototype.hasOwnProperty.call(t,o)&&n.push(o);return n},i="function"==typeof Symbol?function(t){return Object.getOwnPropertySymbols(t)}:function(){return[]};e.getKeys=u,e.getSymbols=i,e.indexOf=n,e.isBuffer=r},function(t,e,n){"use strict";function o(t,e){var n=u(t);return null!==n?u(t):r(t,e)}function r(t,e){if("function"!=typeof e)throw new TypeError("customizer is must be a Function");if("function"==typeof t){var n=String(t);return/^\s*function\s*\S*\([^\)]*\)\s*{\s*\[native code\]\s*}/.test(n)?t:new Function("return "+String(n))()}var o=c.call(t);if("[object Array]"===o)return[];if("[object Object]"===o&&t.constructor===Object)return{};if("[object Date]"===o)return new Date(t.getTime());if("[object RegExp]"===o){var r=String(t),u=r.lastIndexOf("/");return new RegExp(r.slice(1,u),r.slice(u+1))}if((0,i.isBuffer)(t)){var f=new Buffer(t.length);return t.copy(f),f}var l=e(t);return void 0!==l?l:null}function u(t){var e=typeof t;return null!==t&&"object"!==e&&"function"!==e?t:null}e.__esModule=!0,e.copyValue=e.copyCollection=e.copy=void 0;var i=n(1),c=Object.prototype.toString;e.copy=o,e.copyCollection=r,e.copyValue=u},function(t,e,n){"use strict";function o(t){}function r(t){var e=arguments.length<=1||void 0===arguments[1]?o:arguments[1];if(null===t)return null;var n=(0,i.copyValue)(t);if(null!==n)return n;var r=(0,i.copyCollection)(t,e),c=null!==r?r:t,f=[t],l=[c];return u(t,e,c,f,l)}function u(t,e,n,o,r){if(null===t)return null;var f=(0,i.copyValue)(t);if(null!==f)return f;var l=(0,c.getKeys)(t).concat((0,c.getSymbols)(t)),p=void 0,s=void 0,a=void 0,y=void 0,d=void 0,v=void 0,b=void 0,j=void 0;for(p=0,s=l.length;s>p;++p)a=l[p],y=t[a],d=(0,c.indexOf)(o,y),-1===d?(v=(0,i.copy)(y,e),b=null!==v?v:y,null!==y&&/^(?:function|object)$/.test(typeof y)?(o.push(y),r.push(b)):j=b):j=r[d],n[a]=j||u(y,e,b,o,r);return n}e.__esModule=!0;var i=n(2),c=n(1);e["default"]=r,t.exports=e["default"]}])});

@@ -0,1 +1,5 @@

# 0.6.2 / 2016-06-12
- fixed #10
# 0.6.1 / 2016-01-13

@@ -2,0 +6,0 @@

'use strict';
exports.__esModule = true;
exports.copyValue = exports.copyCollection = exports.copy = void 0;

@@ -61,3 +62,3 @@ var _polyfill = require('./polyfill');

// user defined function
return new Function('return ' + source)();
return new Function('return ' + String(source))();
}

@@ -92,3 +93,3 @@ }

// +new Date(+date); // 1420909757913
return new Date(+target);
return new Date(target.getTime());
}

@@ -113,3 +114,3 @@

if (_polyfill.isBuffer(target)) {
if ((0, _polyfill.isBuffer)(target)) {
var buffer = new Buffer(target.length);

@@ -143,7 +144,4 @@

exports['default'] = {
copy: copy,
copyCollection: copyCollection,
copyValue: copyValue
};
module.exports = exports['default'];
exports.copy = copy;
exports.copyCollection = copyCollection;
exports.copyValue = copyValue;

@@ -14,3 +14,3 @@ 'use strict';

function deepcopy(target) {
var customizer = arguments.length <= 1 || arguments[1] === undefined ? defaultCustomizer : arguments[1];
var customizer = arguments.length <= 1 || arguments[1] === void 0 ? defaultCustomizer : arguments[1];

@@ -22,3 +22,3 @@ if (target === null) {

var resultValue = _copy.copyValue(target);
var resultValue = (0, _copy.copyValue)(target);

@@ -30,3 +30,3 @@ if (resultValue !== null) {

var resultCollection = _copy.copyCollection(target, customizer),
var resultCollection = (0, _copy.copyCollection)(target, customizer),
clone = resultCollection !== null ? resultCollection : target;

@@ -47,3 +47,3 @@

var resultValue = _copy.copyValue(target);
var resultValue = (0, _copy.copyValue)(target);

@@ -55,13 +55,13 @@ if (resultValue !== null) {

var keys = _polyfill.getKeys(target).concat(_polyfill.getSymbols(target));
var keys = (0, _polyfill.getKeys)(target).concat((0, _polyfill.getSymbols)(target));
var i = undefined,
len = undefined;
var i = void 0,
len = void 0;
var key = undefined,
value = undefined,
index = undefined,
resultCopy = undefined,
result = undefined,
ref = undefined;
var key = void 0,
value = void 0,
index = void 0,
resultCopy = void 0,
result = void 0,
ref = void 0;

@@ -71,6 +71,6 @@ for (i = 0, len = keys.length; i < len; ++i) {

value = target[key];
index = _polyfill.indexOf(visited, value);
index = (0, _polyfill.indexOf)(visited, value);
if (index === -1) {
resultCopy = _copy.copy(value, customizer);
resultCopy = (0, _copy.copy)(value, customizer);
result = resultCopy !== null ? resultCopy : value;

@@ -81,2 +81,4 @@

reference.push(result);
} else {
ref = result;
}

@@ -83,0 +85,0 @@ } else {

@@ -13,3 +13,3 @@ 'use strict';

var getKeys = Object.keys ? function getKeys(obj) {
var getKeys = typeof Object.keys === 'function' ? function getKeys(obj) {
return Object.keys(obj);

@@ -19,3 +19,3 @@ } : function getKeys(obj) {

if (obj === null || objType !== 'function' || objType !== 'object') {
if (obj === null || objType !== 'function' && objType !== 'object') {
throw new TypeError('obj must be an Object');

@@ -25,6 +25,6 @@ }

var resultKeys = [],
key = undefined;
key = void 0;
for (key in obj) {
obj.hasOwnProperty(key) && resultKeys.push(key);
Object.prototype.hasOwnProperty.call(obj, key) && resultKeys.push(key);
}

@@ -53,5 +53,5 @@

var i = undefined,
len = undefined,
value = undefined;
var i = void 0,
len = void 0,
value = void 0;

@@ -61,6 +61,9 @@ for (i = 0, len = array.length; i < len; ++i) {

// it is SameValue algorithm
// http://stackoverflow.com/questions/27144277/comparing-a-variable-with-itself
// NOTE:
//
// it is SameValue algorithm
// http://stackoverflow.com/questions/27144277/comparing-a-variable-with-itself
//
// eslint-disable-next-line no-self-compare
if (value === s || value !== value && s !== s) {
// eslint-disable-line no-self-compare
return i;

@@ -73,8 +76,5 @@ }

exports['default'] = {
getKeys: getKeys,
getSymbols: getSymbols,
indexOf: indexOf,
isBuffer: isBuffer
};
module.exports = exports['default'];
exports.getKeys = getKeys;
exports.getSymbols = getSymbols;
exports.indexOf = indexOf;
exports.isBuffer = isBuffer;
{
"name": "deepcopy",
"version": "0.6.1",
"version": "0.6.2",
"author": "sasa+1 <sasaplus1@gmail.com>",

@@ -18,36 +18,50 @@ "contributors": [

"babel": "babel --out-dir ./lib ./src",
"build": "npm ru clean && npm ru babel && npm ru compile && npm ru minify",
"clean": "npm ru rimraf -- ./build ./lib",
"compile": "npm ru webpack -- --output-filename ./build/deepcopy.js",
"develop": " parallelshell 'npm ru babel -- -w' 'npm ru compile -- -w' 'npm ru minify -- -w'",
"build": "npm run clean && npm run babel && npm run compile && npm run minify",
"clean": "npm run rimraf -- ./build ./lib",
"compile": "npm run webpack -- --output-filename ./build/deepcopy.js",
"develop": " parallelshell 'npm run babel -- -w' 'npm run compile -- -w' 'npm run minify -- -w'",
"eslint": "eslint",
"karma": "karma",
"lint": "npm ru eslint -- --ext .js .",
"minify": "npm ru webpack -- --optimize-minimize --output-filename ./build/deepcopy.min.js",
"lint": "npm run eslint -- --ext .js .",
"minify": "npm run webpack -- --optimize-minimize --output-filename ./build/deepcopy.min.js",
"mocha": "mocha",
"posttest": "npm ru karma -- start --single-run --browsers Chrome,Firefox,Safari",
"prepublish": "npm ru build",
"posttest": "npm run karma -- start --single-run --browsers Chrome,Firefox,Safari",
"prepublish": "npm run build",
"rimraf": "rimraf",
"test": "npm ru mocha",
"travis": "npm ru mocha",
"test": "npm run mocha",
"travis": "npm run mocha",
"webpack": "webpack --colors --display-error-details --progress"
},
"devDependencies": {
"babel": "5.8.34",
"babel-eslint": "4.1.6",
"babel-loader": "5.3.3",
"babel-plugin-espower": "1.0.1",
"babel": "^6.5.2",
"babel-cli": "^6.6.5",
"babel-core": "^6.7.2",
"babel-eslint": "^6.0.4",
"babel-loader": "^6.2.4",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-check-es2015-constants": "^6.7.2",
"babel-plugin-espower": "^2.1.2",
"babel-plugin-transform-es2015-arrow-functions": "^6.5.2",
"babel-plugin-transform-es2015-block-scoping": "^6.7.1",
"babel-plugin-transform-es2015-computed-properties": "^6.6.5",
"babel-plugin-transform-es2015-modules-commonjs": "^6.7.0",
"babel-plugin-transform-es2015-parameters": "^6.7.0",
"babel-plugin-transform-es2015-template-literals": "^6.6.5",
"babel-plugin-transform-es3-member-expression-literals": "^6.5.0",
"babel-plugin-transform-es3-property-literals": "^6.5.0",
"babel-plugin-transform-strict-mode": "^6.6.5",
"babel-plugin-transform-undefined-to-void": "^6.5.0",
"coffee-script": "^1.10.0",
"eslint": "^1.10.3",
"eslint-config-sasaplus1": "git://github.com/sasaplus1-prototype/eslint-config-sasaplus1.git",
"espower-babel": "3.3.0",
"eslint": "^2.4.0",
"eslint-config-sasaplus1": "sasaplus1-prototype/eslint-config-sasaplus1.git",
"espower-babel": "4.0.3",
"karma": "^0.13.15",
"karma-chrome-launcher": "^0.2.2",
"karma-firefox-launcher": "^0.1.7",
"karma-mocha": "^0.2.1",
"karma-safari-launcher": "^0.1.1",
"karma-chrome-launcher": "^1.0.1",
"karma-firefox-launcher": "^1.0.0",
"karma-mocha": "^1.0.1",
"karma-safari-launcher": "^1.0.0",
"karma-webpack": "^1.7.0",
"mocha": "^2.3.4",
"parallelshell": "^2.0.0",
"power-assert": "^1.2.0",
"power-assert": "^1.3.1",
"rimraf": "^2.4.4",

@@ -54,0 +68,0 @@ "webpack": "^1.12.9"

@@ -87,3 +87,3 @@ import { isBuffer } from './polyfill';

// +new Date(+date); // 1420909757913
return new Date(+target);
return new Date(target.getTime());
}

@@ -140,3 +140,3 @@

export default {
export {
copy,

@@ -143,0 +143,0 @@ copyCollection,

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

import { copy, copyCollection, copyValue } from './copy';
import { getKeys, getSymbols, indexOf } from './polyfill';
import {
copy,
copyCollection,
copyValue,
} from './copy';
import {
getKeys,
getSymbols,
indexOf,
} from './polyfill';
function defaultCustomizer(target) {

@@ -62,2 +71,4 @@ return void 0;

reference.push(result);
} else {
ref = result;
}

@@ -64,0 +75,0 @@ } else {

@@ -12,3 +12,3 @@ const toString = Object.prototype.toString;

const getKeys = (Object.keys) ?
const getKeys = (typeof Object.keys === 'function') ?
function getKeys(obj) {

@@ -20,3 +20,3 @@ return Object.keys(obj);

if (obj === null || objType !== 'function' || objType !== 'object') {
if (obj === null || (objType !== 'function' && objType !== 'object')) {
throw new TypeError('obj must be an Object');

@@ -29,3 +29,3 @@ }

for (key in obj) {
obj.hasOwnProperty(key) && resultKeys.push(key);
Object.prototype.hasOwnProperty.call(obj, key) && resultKeys.push(key);
}

@@ -61,5 +61,9 @@

// it is SameValue algorithm
// http://stackoverflow.com/questions/27144277/comparing-a-variable-with-itself
if (value === s || (value !== value && s !== s)) { // eslint-disable-line no-self-compare
// NOTE:
//
// it is SameValue algorithm
// http://stackoverflow.com/questions/27144277/comparing-a-variable-with-itself
//
// eslint-disable-next-line no-self-compare
if (value === s || (value !== value && s !== s)) {
return i;

@@ -72,3 +76,3 @@ }

export default {
export {
getKeys,

@@ -75,0 +79,0 @@ getSymbols,

Sorry, the diff of this file is not supported yet

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