This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(limitTo): start at 0 if
begin
is negative and exceeds input length
Previously, specifying a negative `begin` whose abs value exceeds the input's length, would behave unexpectedly (depending on the value of `limit` relative to `begin`). E.g.: ``` limitToFilter('12345', 3, -7) === '1' // but limitToFilter('12345', 10, -7) === '123' ``` This commit fixes the unexpected behaviour, by setting `begin` to 0 in the aforementioned cases. Thus, the previous examples become: ``` limitToFilter('12345', 3, -7) === limitToFilter('12345', 3, 0) === '123' // and limitToFilter('12345', 10, -7) === limitToFilter('12345', 10, 0) === '12345' ``` Fixes #12775 Closes #12781
- Loading branch information