Travis build: 1175

This commit is contained in:
30secondsofcode
2019-05-29 06:19:16 +00:00
parent 7db36a21d1
commit 9063fad13d
5 changed files with 12 additions and 6 deletions

View File

@ -279,8 +279,9 @@ const distance = (x0, y0, x1, y1) => Math.hypot(x1 - x0, y1 - y0);
const drop = (arr, n = 1) => arr.slice(n);
const dropRight = (arr, n = 1) => arr.slice(0, -n);
const dropRightWhile = (arr, func) => {
while (arr.length > 0 && !func(arr[arr.length - 1])) arr = arr.slice(0, -1);
return arr;
let rightIndex = arr.length;
while (rightIndex-- && !func(arr[rightIndex]));
return arr.slice(0, rightIndex + 1);
};
const dropWhile = (arr, func) => {
while (arr.length > 0 && !func(arr[0])) arr = arr.slice(1);