From 30b8b2160c7581fb187b31fe928caeee2b4351cc Mon Sep 17 00:00:00 2001 From: sasaplus1 Date: Sun, 12 Jun 2016 13:42:43 +0900 Subject: [PATCH] updated build scripts --- build/deepcopy.js | 82 +++++++++++++++++++++---------------------- build/deepcopy.min.js | 2 +- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/build/deepcopy.js b/build/deepcopy.js index b6c63d17..ee5c4d6d 100644 --- a/build/deepcopy.js +++ b/build/deepcopy.js @@ -79,20 +79,20 @@ return /******/ (function(modules) { // webpackBootstrap return false; }; - var getKeys = Object.keys ? function getKeys(obj) { + var getKeys = typeof Object.keys === 'function' ? function getKeys(obj) { return Object.keys(obj); } : function getKeys(obj) { var objType = typeof obj; - if (obj === null || objType !== 'function' || objType !== 'object') { + if (obj === null || objType !== 'function' && objType !== 'object') { throw new TypeError('obj must be an Object'); } 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); } return resultKeys; @@ -116,17 +116,20 @@ return /******/ (function(modules) { // webpackBootstrap throw new TypeError('array must be an Array'); } - var i = undefined, - len = undefined, - value = undefined; + var i = void 0, + len = void 0, + value = void 0; for (i = 0, len = array.length; i < len; ++i) { value = array[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; } } @@ -134,13 +137,10 @@ return /******/ (function(modules) { // webpackBootstrap return -1; } - 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; /***/ }, /* 2 */ @@ -149,6 +149,7 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; exports.__esModule = true; + exports.copyValue = exports.copyCollection = exports.copy = void 0; var _polyfill = __webpack_require__(1); @@ -206,7 +207,7 @@ return /******/ (function(modules) { // webpackBootstrap return target; } else { // user defined function - return new Function('return ' + source)(); + return new Function('return ' + String(source))(); } } @@ -236,7 +237,7 @@ return /******/ (function(modules) { // webpackBootstrap // +date; // 1420909757913 // +new Date(date); // 1420909757913 // +new Date(+date); // 1420909757913 - return new Date(+target); + return new Date(target.getTime()); } if (targetClass === '[object RegExp]') { @@ -256,7 +257,7 @@ return /******/ (function(modules) { // webpackBootstrap return new RegExp(regexpText.slice(1, slashIndex), regexpText.slice(slashIndex + 1)); } - if (_polyfill.isBuffer(target)) { + if ((0, _polyfill.isBuffer)(target)) { var buffer = new Buffer(target.length); target.copy(buffer); @@ -285,12 +286,9 @@ return /******/ (function(modules) { // webpackBootstrap return null; } - exports['default'] = { - copy: copy, - copyCollection: copyCollection, - copyValue: copyValue - }; - module.exports = exports['default']; + exports.copy = copy; + exports.copyCollection = copyCollection; + exports.copyValue = copyValue; /***/ }, /* 3 */ @@ -309,21 +307,21 @@ return /******/ (function(modules) { // webpackBootstrap } 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]; if (target === null) { // copy null return null; } - var resultValue = _copy.copyValue(target); + var resultValue = (0, _copy.copyValue)(target); if (resultValue !== null) { // copy some primitive types return resultValue; } - var resultCollection = _copy.copyCollection(target, customizer), + var resultCollection = (0, _copy.copyCollection)(target, customizer), clone = resultCollection !== null ? resultCollection : target; var visited = [target], @@ -339,37 +337,39 @@ return /******/ (function(modules) { // webpackBootstrap return null; } - var resultValue = _copy.copyValue(target); + var resultValue = (0, _copy.copyValue)(target); if (resultValue !== null) { // copy some primitive types return resultValue; } - 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; for (i = 0, len = keys.length; i < len; ++i) { key = keys[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; if (value !== null && /^(?:function|object)$/.test(typeof value)) { visited.push(value); reference.push(result); + } else { + ref = result; } } else { // circular reference diff --git a/build/deepcopy.min.js b/build/deepcopy.min.js index 6596ecdb..9cee2c14 100644 --- a/build/deepcopy.min.js +++ b/build/deepcopy.min.js @@ -3,4 +3,4 @@ * https://github.com/sasaplus1/deepcopy.js * Released under the MIT license. */ -!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"]}])}); \ No newline at end of file +!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"]}])}); \ No newline at end of file