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 angular#12775 Closes angular#12781
- Loading branch information