Comparing version 2.0.2 to 2.0.3
# fast-copy CHANGELOG | ||
## 2.0.3 | ||
- Add safety to constructing native objects (fixes #19) | ||
## 2.0.2 | ||
@@ -4,0 +8,0 @@ |
@@ -56,3 +56,6 @@ 'use strict'; | ||
if (~toStringFunction.call(object.constructor).indexOf('[native code]')) { | ||
return new object.constructor(); | ||
try { | ||
return new object.constructor(); | ||
} | ||
catch (_a) { } | ||
} | ||
@@ -59,0 +62,0 @@ return create(prototype); |
@@ -54,3 +54,6 @@ var toStringFunction = Function.prototype.toString; | ||
if (~toStringFunction.call(object.constructor).indexOf('[native code]')) { | ||
return new object.constructor(); | ||
try { | ||
return new object.constructor(); | ||
} | ||
catch (_a) { } | ||
} | ||
@@ -57,0 +60,0 @@ return create(prototype); |
@@ -60,3 +60,6 @@ (function (global, factory) { | ||
if (~toStringFunction.call(object.constructor).indexOf('[native code]')) { | ||
return new object.constructor(); | ||
try { | ||
return new object.constructor(); | ||
} | ||
catch (_a) { } | ||
} | ||
@@ -63,0 +66,0 @@ return create(prototype); |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self)["fast-copy"]=t()}(this,function(){"use strict";var e=Function.prototype.toString,t=Object.create,r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,f=Object.getOwnPropertySymbols,i=Object.getPrototypeOf,a=Object.prototype,c=a.hasOwnProperty,u=a.propertyIsEnumerable,l="function"==typeof f,s="function"==typeof WeakSet,d=function(){if(s)return new WeakSet;var e=t({add:function(t){return e._values.push(t)},has:function(t){return!!~e._values.indexOf(t)}});return e._values=[],e},p=function(r,n){if(!r.constructor)return t(null);var o=r.__proto__||i(r);return r.constructor===n.Object?o===n.Object.prototype?{}:t(o):~e.call(r.constructor).indexOf("[native code]")?new r.constructor:t(o)},y=function(e,t,r,n){var o=p(e,t);for(var i in e)c.call(e,i)&&(o[i]=r(e[i],n));if(l){var a=f(e);if(a.length)for(var s=0,d=void 0;s<a.length;s++)d=a[s],u.call(e,d)&&(o[d]=r(e[d],n))}return o},v=function(e,t,i,a){var c=p(e,t),u=l?[].concat(o(e),f(e)):o(e);if(u.length)for(var s=0,d=void 0,y=void 0;s<u.length;s++)"callee"!==(d=u[s])&&"caller"!==d&&((y=n(e,d)).value=i(e[d],a),r(c,d,y));return c},g=function(e){var t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t},b=Array.isArray,w="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void(console&&console.error&&console.error('Unable to locate global object, returning "this".'));function O(e,t){var r=!(!t||!t.isStrict),n=t&&t.realm||w,o=r?v:y,f=function(e,t){if(!e||"object"!=typeof e||t.has(e))return e;var i,a=e.constructor;if(a===n.Object)return t.add(e),o(e,n,f,t);if(b(e)){if(t.add(e),r)return v(e,n,f,t);i=new a;for(var c=0;c<e.length;c++)i[c]=f(e[c],t);return i}if(e instanceof n.Date)return new a(e.getTime());if(e instanceof n.RegExp)return(i=new a(e.source,e.flags||g(e))).lastIndex=e.lastIndex,i;if(n.Map&&e instanceof n.Map)return t.add(e),i=new a,e.forEach(function(e,r){i.set(r,f(e,t))}),i;if(n.Set&&e instanceof n.Set)return t.add(e),i=new a,e.forEach(function(e){i.add(f(e,t))}),i;if(n.Buffer&&n.Buffer.isBuffer(e))return i=n.Buffer.allocUnsafe?n.Buffer.allocUnsafe(e.length):new a(e.length),e.copy(i),i;if(n.ArrayBuffer){if(n.ArrayBuffer.isView(e))return new a(e.buffer.slice(0));if(e instanceof n.ArrayBuffer)return e.slice(0)}return"function"==typeof e.then||e instanceof Error||n.WeakMap&&e instanceof n.WeakMap||n.WeakSet&&e instanceof n.WeakSet?e:(t.add(e),o(e,n,f,t))};return f(e,d())}return O.strict=function(e,t){return O(e,{isStrict:!0,realm:t?t.realm:void 0})},O}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self)["fast-copy"]=t()}(this,function(){"use strict";var e=Function.prototype.toString,t=Object.create,r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,f=Object.getOwnPropertySymbols,i=Object.getPrototypeOf,a=Object.prototype,c=a.hasOwnProperty,u=a.propertyIsEnumerable,l="function"==typeof f,s="function"==typeof WeakSet,d=function(){if(s)return new WeakSet;var e=t({add:function(t){return e._values.push(t)},has:function(t){return!!~e._values.indexOf(t)}});return e._values=[],e},p=function(r,n){if(!r.constructor)return t(null);var o=r.__proto__||i(r);if(r.constructor===n.Object)return o===n.Object.prototype?{}:t(o);if(~e.call(r.constructor).indexOf("[native code]"))try{return new r.constructor}catch(e){}return t(o)},y=function(e,t,r,n){var o=p(e,t);for(var i in e)c.call(e,i)&&(o[i]=r(e[i],n));if(l){var a=f(e);if(a.length)for(var s=0,d=void 0;s<a.length;s++)d=a[s],u.call(e,d)&&(o[d]=r(e[d],n))}return o},v=function(e,t,i,a){var c=p(e,t),u=l?[].concat(o(e),f(e)):o(e);if(u.length)for(var s=0,d=void 0,y=void 0;s<u.length;s++)"callee"!==(d=u[s])&&"caller"!==d&&((y=n(e,d)).value=i(e[d],a),r(c,d,y));return c},g=function(e){var t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t},b=Array.isArray,w="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void(console&&console.error&&console.error('Unable to locate global object, returning "this".'));function h(e,t){var r=!(!t||!t.isStrict),n=t&&t.realm||w,o=r?v:y,f=function(e,t){if(!e||"object"!=typeof e||t.has(e))return e;var i,a=e.constructor;if(a===n.Object)return t.add(e),o(e,n,f,t);if(b(e)){if(t.add(e),r)return v(e,n,f,t);i=new a;for(var c=0;c<e.length;c++)i[c]=f(e[c],t);return i}if(e instanceof n.Date)return new a(e.getTime());if(e instanceof n.RegExp)return(i=new a(e.source,e.flags||g(e))).lastIndex=e.lastIndex,i;if(n.Map&&e instanceof n.Map)return t.add(e),i=new a,e.forEach(function(e,r){i.set(r,f(e,t))}),i;if(n.Set&&e instanceof n.Set)return t.add(e),i=new a,e.forEach(function(e){i.add(f(e,t))}),i;if(n.Buffer&&n.Buffer.isBuffer(e))return i=n.Buffer.allocUnsafe?n.Buffer.allocUnsafe(e.length):new a(e.length),e.copy(i),i;if(n.ArrayBuffer){if(n.ArrayBuffer.isView(e))return new a(e.buffer.slice(0));if(e instanceof n.ArrayBuffer)return e.slice(0)}return"function"==typeof e.then||e instanceof Error||n.WeakMap&&e instanceof n.WeakMap||n.WeakSet&&e instanceof n.WeakSet?e:(t.add(e),o(e,n,f,t))};return f(e,d())}return h.strict=function(e,t){return h(e,{isStrict:!0,realm:t?t.realm:void 0})},h}); |
@@ -9,7 +9,7 @@ { | ||
"devDependencies": { | ||
"@types/jest": "^23.3.13", | ||
"@types/lodash": "^4.14.120", | ||
"@types/node": "^10.12.19", | ||
"@types/ramda": "^0.25.47", | ||
"@types/react": "^16.7.22", | ||
"@types/jest": "^24.0.4", | ||
"@types/lodash": "^4.14.121", | ||
"@types/node": "^11.9.3", | ||
"@types/ramda": "^0.25.50", | ||
"@types/react": "^16.8.3", | ||
"benchee": "^1.0.3", | ||
@@ -23,11 +23,11 @@ "cli-table2": "^0.2.0", | ||
"in-publish": "^2.0.0", | ||
"jest": "^24.0.0", | ||
"jest": "^24.1.0", | ||
"lodash": "^4.17.11", | ||
"nyc": "^13.0.1", | ||
"nyc": "^13.2.0", | ||
"ramda": "^0.26.1", | ||
"react": "^16.7.0", | ||
"react-dom": "^16.7.0", | ||
"react": "^16.8.1", | ||
"react-dom": "^16.8.1", | ||
"rollup": "^1.1.0", | ||
"rollup-plugin-node-resolve": "^4.0.0", | ||
"rollup-plugin-terser": "^4.0.3", | ||
"rollup-plugin-terser": "^4.0.4", | ||
"rollup-plugin-typescript2": "^0.19.2", | ||
@@ -39,5 +39,5 @@ "ts-jest": "^23.10.4", | ||
"tslint-loader": "^3.5.4", | ||
"typescript": "^3.2.4", | ||
"webpack": "^4.29.0", | ||
"webpack-cli": "^3.2.0", | ||
"typescript": "^3.3.3", | ||
"webpack": "^4.29.3", | ||
"webpack-cli": "^3.2.3", | ||
"webpack-dev-server": "^3.1.5" | ||
@@ -76,3 +76,3 @@ }, | ||
"types": "index.d.ts", | ||
"version": "2.0.2" | ||
"version": "2.0.3" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
98030
976