montagejs / collections

This package contains JavaScript implementations of common data structures with idiomatic interfaces.
http://www.collectionsjs.com
Other
2.1k stars 183 forks source link

Cap splice's index parameter to length #60

Closed aadsm closed 10 years ago

aadsm commented 10 years ago

When the index parameter of a splice is beyond its length then the length should be taken as the index.

http://www.ecma-international.org/ecma-262/5.1/#sec-15.4.4.12

6. If relativeStart is negative, let actualStart be max((len + relativeStart),0); else let actualStart be min(relativeStart, len).