Comparing version 2.1.0 to 2.1.1
# fast-copy CHANGELOG | ||
## 2.1.1 | ||
- Fix ESM-to-CommonJS issue when using TSC to consume [#37](https://github.com/planttheidea/fast-copy/issues/37) | ||
- Modify `Blob` cloning to use `blob.slice()` instead of `new Blob()` for speed | ||
## 2.1.0 | ||
- Support cloning `Blob` [#31](https://github.com/planttheidea/fast-copy/pull/31) (thanks [@fratzigner](https://github.com/fratzinger)) | ||
- Fix cloning descriptors that only are getters / setters in strict mode | ||
- Handle errors when defining properties in strict mode | ||
## 2.0.5 | ||
@@ -4,0 +15,0 @@ |
@@ -290,4 +290,3 @@ 'use strict'; | ||
if (realm.Blob && object instanceof realm.Blob) { | ||
clone = new Blob([object], { type: object.type }); | ||
return clone; | ||
return object.slice(0, object.size, object.type); | ||
} | ||
@@ -335,2 +334,6 @@ // buffers (node-only) | ||
} | ||
// Adding reference to allow usage in CommonJS libraries compiled using TSC, which | ||
// expects there to be a default property on the exported object. See | ||
// [#37](https://github.com/planttheidea/fast-copy/issues/37) for details. | ||
copy.default = copy; | ||
/** | ||
@@ -337,0 +340,0 @@ * @function strictCopy |
@@ -288,4 +288,3 @@ var toStringFunction = Function.prototype.toString; | ||
if (realm.Blob && object instanceof realm.Blob) { | ||
clone = new Blob([object], { type: object.type }); | ||
return clone; | ||
return object.slice(0, object.size, object.type); | ||
} | ||
@@ -333,2 +332,6 @@ // buffers (node-only) | ||
} | ||
// Adding reference to allow usage in CommonJS libraries compiled using TSC, which | ||
// expects there to be a default property on the exported object. See | ||
// [#37](https://github.com/planttheidea/fast-copy/issues/37) for details. | ||
copy.default = copy; | ||
/** | ||
@@ -335,0 +338,0 @@ * @function strictCopy |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
typeof define === 'function' && define.amd ? define(factory) : | ||
(global = global || self, global['fast-copy'] = factory()); | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global['fast-copy'] = factory()); | ||
}(this, (function () { 'use strict'; | ||
@@ -294,4 +294,3 @@ | ||
if (realm.Blob && object instanceof realm.Blob) { | ||
clone = new Blob([object], { type: object.type }); | ||
return clone; | ||
return object.slice(0, object.size, object.type); | ||
} | ||
@@ -339,2 +338,6 @@ // buffers (node-only) | ||
} | ||
// Adding reference to allow usage in CommonJS libraries compiled using TSC, which | ||
// expects there to be a default property on the exported object. See | ||
// [#37](https://github.com/planttheidea/fast-copy/issues/37) for details. | ||
copy.default = copy; | ||
/** | ||
@@ -341,0 +344,0 @@ * @function strictCopy |
@@ -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,s="function"==typeof f,l="function"==typeof WeakMap,p=function(r,n){if(!r.constructor)return t(null);var o=r.constructor,f=r.__proto__||i(r);if(o===n.Object)return f===n.Object.prototype?{}:t(f);if(~e.call(o).indexOf("[native code]"))try{return new o}catch(e){}return t(f)},y=function(e,t,r,n){var o=p(e,t);for(var i in n.set(e,o),e)c.call(e,i)&&(o[i]=r(e[i],n));if(s){var a=f(e),l=a.length;if(l)for(var y=0,d=void 0;y<l;y++)d=a[y],u.call(e,d)&&(o[d]=r(e[d],n))}return o},d=function(e,t,i,a){var c=p(e,t);a.set(e,c);var u=s?o(e).concat(f(e)):o(e),l=u.length;if(l)for(var y=0,d=void 0,v=void 0;y<l;y++)if("callee"!==(d=u[y])&&"caller"!==d)if(v=n(e,d)){v.get||v.set||(v.value=i(e[d],a));try{r(c,d,v)}catch(e){c[d]=v.value}}else c[d]=i(e[d],a);return c},v=Array.isArray,b="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 g(e,r){var n=!(!r||!r.isStrict),o=r&&r.realm||b,f=n?d:y,i=function(e,t){if(!e||"object"!=typeof e)return e;if(t.has(e))return t.get(e);var r,a,c,u=e.constructor;if(u===o.Object)return f(e,o,i,t);if(v(e)){if(n)return d(e,o,i,t);var s=e.length;r=new u,t.set(e,r);for(var l=0;l<s;l++)r[l]=i(e[l],t);return r}if(e instanceof o.Date)return new u(e.getTime());if(e instanceof o.RegExp)return(r=new u(e.source,e.flags||(c="",(a=e).global&&(c+="g"),a.ignoreCase&&(c+="i"),a.multiline&&(c+="m"),a.unicode&&(c+="u"),a.sticky&&(c+="y"),c))).lastIndex=e.lastIndex,r;if(o.Map&&e instanceof o.Map)return r=new u,t.set(e,r),e.forEach((function(e,n){r.set(n,i(e,t))})),r;if(o.Set&&e instanceof o.Set)return r=new u,t.set(e,r),e.forEach((function(e){r.add(i(e,t))})),r;if(o.Blob&&e instanceof o.Blob)return r=new Blob([e],{type:e.type});if(o.Buffer&&o.Buffer.isBuffer(e))return r=o.Buffer.allocUnsafe?o.Buffer.allocUnsafe(e.length):new u(e.length),t.set(e,r),e.copy(r),r;if(o.ArrayBuffer){if(o.ArrayBuffer.isView(e))return r=new u(e.buffer.slice(0)),t.set(e,r),r;if(e instanceof o.ArrayBuffer)return r=e.slice(0),t.set(e,r),r}return"function"==typeof e.then||e instanceof Error||o.WeakMap&&e instanceof o.WeakMap||o.WeakSet&&e instanceof o.WeakSet?e:f(e,o,i,t)};return i(e,function(){if(l)return new WeakMap;var e=t({has:function(t){return!!~e._keys.indexOf(t)},set:function(t,r){e._keys.push(t),e._values.push(r)},get:function(t){return e._values[e._keys.indexOf(t)]}});return e._keys=[],e._values=[],e}())}return g.strict=function(e,t){return g(e,{isStrict:!0,realm:t?t.realm:void 0})},g})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis: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,s="function"==typeof f,l="function"==typeof WeakMap,p=function(r,n){if(!r.constructor)return t(null);var o=r.constructor,f=r.__proto__||i(r);if(o===n.Object)return f===n.Object.prototype?{}:t(f);if(~e.call(o).indexOf("[native code]"))try{return new o}catch(e){}return t(f)},y=function(e,t,r,n){var o=p(e,t);for(var i in n.set(e,o),e)c.call(e,i)&&(o[i]=r(e[i],n));if(s){var a=f(e),l=a.length;if(l)for(var y=0,d=void 0;y<l;y++)d=a[y],u.call(e,d)&&(o[d]=r(e[d],n))}return o},d=function(e,t,i,a){var c=p(e,t);a.set(e,c);var u=s?o(e).concat(f(e)):o(e),l=u.length;if(l)for(var y=0,d=void 0,b=void 0;y<l;y++)if("callee"!==(d=u[y])&&"caller"!==d)if(b=n(e,d)){b.get||b.set||(b.value=i(e[d],a));try{r(c,d,b)}catch(e){c[d]=b.value}}else c[d]=i(e[d],a);return c},b=Array.isArray,g="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 v(e,r){var n=!(!r||!r.isStrict),o=r&&r.realm||g,f=n?d:y,i=function(e,t){if(!e||"object"!=typeof e)return e;if(t.has(e))return t.get(e);var r,a,c,u=e.constructor;if(u===o.Object)return f(e,o,i,t);if(b(e)){if(n)return d(e,o,i,t);var s=e.length;r=new u,t.set(e,r);for(var l=0;l<s;l++)r[l]=i(e[l],t);return r}if(e instanceof o.Date)return new u(e.getTime());if(e instanceof o.RegExp)return(r=new u(e.source,e.flags||(c="",(a=e).global&&(c+="g"),a.ignoreCase&&(c+="i"),a.multiline&&(c+="m"),a.unicode&&(c+="u"),a.sticky&&(c+="y"),c))).lastIndex=e.lastIndex,r;if(o.Map&&e instanceof o.Map)return r=new u,t.set(e,r),e.forEach((function(e,n){r.set(n,i(e,t))})),r;if(o.Set&&e instanceof o.Set)return r=new u,t.set(e,r),e.forEach((function(e){r.add(i(e,t))})),r;if(o.Blob&&e instanceof o.Blob)return e.slice(0,e.size,e.type);if(o.Buffer&&o.Buffer.isBuffer(e))return r=o.Buffer.allocUnsafe?o.Buffer.allocUnsafe(e.length):new u(e.length),t.set(e,r),e.copy(r),r;if(o.ArrayBuffer){if(o.ArrayBuffer.isView(e))return r=new u(e.buffer.slice(0)),t.set(e,r),r;if(e instanceof o.ArrayBuffer)return r=e.slice(0),t.set(e,r),r}return"function"==typeof e.then||e instanceof Error||o.WeakMap&&e instanceof o.WeakMap||o.WeakSet&&e instanceof o.WeakSet?e:f(e,o,i,t)};return i(e,function(){if(l)return new WeakMap;var e=t({has:function(t){return!!~e._keys.indexOf(t)},set:function(t,r){e._keys.push(t),e._values.push(r)},get:function(t){return e._values[e._keys.indexOf(t)]}});return e._keys=[],e._values=[],e}())}return v.default=v,v.strict=function(e,t){return v(e,{isStrict:!0,realm:t?t.realm:void 0})},v})); |
@@ -78,3 +78,3 @@ { | ||
"types": "index.d.ts", | ||
"version": "2.1.0" | ||
"version": "2.1.1" | ||
} |
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
114100
1122