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

fast-copy

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-copy - npm Package Compare versions

Comparing version 2.0.5 to 2.1.0

4

CHANGELOG.md
# fast-copy CHANGELOG
## 2.0.5
- Fix issue copying objects referenced multiple times in source [#28](https://github.com/planttheidea/fast-copy/pull/28) (thanks [@darkowic](https://github.com/darkowic))
## 2.0.4

@@ -4,0 +8,0 @@

@@ -130,4 +130,20 @@ 'use strict';

descriptor = getOwnPropertyDescriptor(object, property);
descriptor.value = handleCopy(object[property], cache);
defineProperty(clone, property, descriptor);
if (descriptor) {
// Only clone the value if actually a value, not a getter / setter.
if (!descriptor.get && !descriptor.set) {
descriptor.value = handleCopy(object[property], cache);
}
try {
defineProperty(clone, property, descriptor);
}
catch (error) {
// Tee above can fail on node in edge cases, so fall back to the loose assignment.
clone[property] = descriptor.value;
}
}
else {
// In extra edge cases where the property descriptor cannot be retrived, fall back to
// the loose assignment.
clone[property] = handleCopy(object[property], cache);
}
}

@@ -273,2 +289,7 @@ }

}
// blobs
if (realm.Blob && object instanceof realm.Blob) {
clone = new Blob([object], { type: object.type });
return clone;
}
// buffers (node-only)

@@ -275,0 +296,0 @@ if (realm.Buffer && realm.Buffer.isBuffer(object)) {

@@ -128,4 +128,20 @@ var toStringFunction = Function.prototype.toString;

descriptor = getOwnPropertyDescriptor(object, property);
descriptor.value = handleCopy(object[property], cache);
defineProperty(clone, property, descriptor);
if (descriptor) {
// Only clone the value if actually a value, not a getter / setter.
if (!descriptor.get && !descriptor.set) {
descriptor.value = handleCopy(object[property], cache);
}
try {
defineProperty(clone, property, descriptor);
}
catch (error) {
// Tee above can fail on node in edge cases, so fall back to the loose assignment.
clone[property] = descriptor.value;
}
}
else {
// In extra edge cases where the property descriptor cannot be retrived, fall back to
// the loose assignment.
clone[property] = handleCopy(object[property], cache);
}
}

@@ -271,2 +287,7 @@ }

}
// blobs
if (realm.Blob && object instanceof realm.Blob) {
clone = new Blob([object], { type: object.type });
return clone;
}
// buffers (node-only)

@@ -273,0 +294,0 @@ if (realm.Buffer && realm.Buffer.isBuffer(object)) {

@@ -134,4 +134,20 @@ (function (global, factory) {

descriptor = getOwnPropertyDescriptor(object, property);
descriptor.value = handleCopy(object[property], cache);
defineProperty(clone, property, descriptor);
if (descriptor) {
// Only clone the value if actually a value, not a getter / setter.
if (!descriptor.get && !descriptor.set) {
descriptor.value = handleCopy(object[property], cache);
}
try {
defineProperty(clone, property, descriptor);
}
catch (error) {
// Tee above can fail on node in edge cases, so fall back to the loose assignment.
clone[property] = descriptor.value;
}
}
else {
// In extra edge cases where the property descriptor cannot be retrived, fall back to
// the loose assignment.
clone[property] = handleCopy(object[property], cache);
}
}

@@ -277,2 +293,7 @@ }

}
// blobs
if (realm.Blob && object instanceof realm.Blob) {
clone = new Blob([object], { type: object.type });
return clone;
}
// buffers (node-only)

@@ -279,0 +300,0 @@ if (realm.Buffer && realm.Buffer.isBuffer(object)) {

2

dist/fast-copy.min.js

@@ -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++)"callee"!==(d=u[y])&&"caller"!==d&&((v=n(e,d)).value=i(e[d],a),r(c,d,v));return c},v=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 b(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(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.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 b.strict=function(e,t){return b(e,{isStrict:!0,realm:t?t.realm:void 0})},b}));
!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}));

@@ -12,7 +12,7 @@ {

"devDependencies": {
"@types/jest": "^25.1.4",
"@types/lodash": "^4.14.149",
"@types/node": "^13.9.0",
"@types/ramda": "^0.26.43",
"@types/react": "^16.9.23",
"@types/jest": "^26.0.0",
"@types/lodash": "^4.14.155",
"@types/node": "^14.0.13",
"@types/ramda": "^0.27.6",
"@types/react": "^16.9.38",
"benchee": "^1.0.3",

@@ -23,23 +23,23 @@ "cli-table2": "^0.2.0",

"fast-clone": "^1.5.3",
"html-webpack-plugin": "^3.2.0",
"in-publish": "^2.0.0",
"jest": "^25.1.0",
"html-webpack-plugin": "^4.3.0",
"in-publish": "^2.0.1",
"jest": "^26.0.1",
"lodash": "^4.17.11",
"nyc": "^15.0.0",
"nyc": "^15.1.0",
"ramda": "^0.27.0",
"react": "^16.13.0",
"react-dom": "^16.13.0",
"rollup": "^2.0.2",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"rollup": "^2.17.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-terser": "^5.2.0",
"rollup-plugin-typescript2": "^0.26.0",
"ts-jest": "^25.2.1",
"ts-loader": "^6.2.1",
"tslint": "^6.0.0",
"rollup-plugin-terser": "^6.1.0",
"rollup-plugin-typescript2": "^0.27.1",
"ts-jest": "^26.1.0",
"ts-loader": "^7.0.5",
"tslint": "^6.1.2",
"tslint-config-airbnb": "^5.11.2",
"tslint-loader": "^3.5.4",
"typescript": "^3.8.3",
"webpack": "^4.42.0",
"typescript": "^3.9.5",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.10.3"
"webpack-dev-server": "^3.11.0"
},

@@ -69,3 +69,3 @@ "homepage": "https://github.com/planttheidea/fast-copy#readme",

"lint:fix": "npm run lint -- --fix",
"prepublishOnly": "npm run lint && npm run test:coverage && npm run dist",
"prepublishOnly": "npm run lint && npm run typecheck && npm run test && npm run dist",
"release": "release-it",

@@ -77,6 +77,7 @@ "release:beta": "release-it --config=.release-it.beta.json",

"test:coverage": "npm run test -- --coverage",
"test:watch": "npm run test -- --watch"
"test:watch": "npm run test -- --watch",
"typecheck": "tsc src/*.ts --noEmit"
},
"types": "index.d.ts",
"version": "2.0.5"
"version": "2.1.0"
}

@@ -86,2 +86,3 @@ # fast-copy

- `ArrayBuffer`
- `Blob`
- `Buffer`

@@ -88,0 +89,0 @@ - `DataView`

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

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