We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The following clone test of an array containing a WeakMap produces an error:
WeakMap
// WeakMap test const options = { includeNonEnumerable: true }; let wm = new WeakMap(); let obj = { foo: "I am foo" }; wm.set(obj, 42); let src = [1, 2, wm, "bar"]; let dest = clone(src, options); dest[1] = 3.1416; console.log(src); // [ 1, 2, WeakMap { <items unknown> }, 'bar' ] console.log(dest); // [ 1, 3.1416, WeakMap {}, 'bar' ] let destMap = dest[2]; console.log(destMap instanceof WeakMap); // true destMap.has(obj); // TypeError: Method WeakMap.prototype.has called on incompatible receiver #<WeakMap>
An identical error occurs when running a similar test with WeakSet:
WeakSet
// TypeError: Method WeakSet.prototype.has called on incompatible receiver #<WeakSet>
The text was updated successfully, but these errors were encountered:
Also, in the following test, clone failed to copy the ArrayCustom prototype.
ArrayCustom
class ArrayCustom extends Array { custom() { return true; } } let src = [1, 2, ArrayCustom.from(["I", "am", "foo"])]; let dest = clone(src); dest[1] = 2.00001; console.log(src); // [ 1, 2, ArrayCustom [ 'I', 'am', 'foo' ] ] console.log(dest); // [ 1, 2.00001, [ 'I', 'am', 'foo' ] ] let destCustom = dest[2]; if (!(destCustom instanceof ArrayCustom)) { throw "Error: failed to preserve ArrayCustom prototype"; } // Error: failed to preserve ArrayCustom prototype
Sorry, something went wrong.
No branches or pull requests
The following clone test of an array containing a
WeakMap
produces an error:An identical error occurs when running a similar test with
WeakSet
:// TypeError: Method WeakSet.prototype.has called on incompatible receiver #<WeakSet>
The text was updated successfully, but these errors were encountered: