mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-05 08:13:06 +08:00
Math.max, Math.min and Math.hypot over a spread, and the default sort, convert foreign elements with user code. As in Node, the elements are taken first, each foreign value retained, so a conversion that changes the array changes neither the count nor the values the operation sees, and no slot read before the conversion is released under it. join and the numeric element read hold the value they convert, and join reads the length once and stops at a throw. toSorted of an array with foreign elements now builds a copy of the full length and reads its holes as undefined, as for other arrays.