Closed
Description
Describe the bug
The introduction of equality.js in #11610 seems to have broken the behaviour of lastIndexOf()
from 5.0.0-next.134 onwards.
Specifically, from v134 omitting the second argument (fromIndex) seems to default as 0 / falsy rather than the last index of the array.
const arr = [0, 1, 2];
console.log('Without fromIndex:', arr.lastIndexOf(2));
console.log('With fromIndex:', arr.lastIndexOf(2, arr.length - 1));
Before:
Without fromIndex: 2
With fromIndex: 2
After:
Without fromIndex: -1
With fromIndex: 2
Thanks for all the hard work on this. Looking forward to the final release.
Reproduction
As above.
Logs
No response
System Info
System:
OS: macOS 11.7.10
CPU: (4) x64 Intel(R) Core(TM) M-5Y71 CPU @ 1.20GHz
Memory: 49.04 MB / 8.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 20.3.0 - /usr/local/bin/node
npm: 9.6.7 - /usr/local/bin/npm
Browsers:
Chrome: 124.0.6367.210
Safari: 16.6.1
npmPackages:
svelte: ^5.0.0-next.134 => 5.0.0-next.134
Severity
blocking all usage of svelte