Files
lukeed-klona/test/suites/index.js
T
dualfroz 33b06375b9 fix: do not trust spoofable Symbol.toStringTag in type dispatch
Every mode (src/index.js, src/full.js, src/lite.js, src/json.js)
picked its clone strategy from Object.prototype.toString.call(x),
which reads a user-settable Symbol.toStringTag. A plain object
declaring a recognized tag (eg "Map") was routed into that type's
clone branch and crashed on methods it doesn't have; one with an
unrecognized tag fell through every branch and was returned by
reference instead of cloned.

Also check the object's real constructor, which Symbol.toStringTag
cannot affect, so a plain object (or one with no prototype) is still
deep-cloned as a plain object no matter what tag it claims.

Fixes #54
2026-09-04 05:12:29 +02:00

26 lines
911 B
JavaScript

export { default as API } from './api';
export { default as Numbers } from './number';
export { default as Booleans } from './boolean';
export { default as Strings } from './string';
export { default as Nully } from './nullish';
export { default as Maps } from './map';
export { default as Sets } from './set';
export { default as TypedArrays } from './typedarray';
export { default as Descriptors } from './descriptor';
export { default as Symbols } from './symbol';
export { default as ToStringTag } from './tostringtag';
export { default as Dates } from './date';
export { default as RegExps } from './regexp';
export { default as Dicts } from './dictionary';
export { default as Objects } from './object';
export { default as Arrays } from './array';
export { default as Functions } from './function';
export { default as Pollutions } from './pollution';
export { default as Classes } from './class';