Update drop, add dropWhile, dropRightWhile

This commit is contained in:
Angelos Chalaris
2018-01-26 12:23:18 +02:00
parent 49b1fc7947
commit aea334a94a
14 changed files with 65 additions and 31 deletions

View File

@ -1,5 +1,5 @@
const dropElements = (arr, func) => {
const dropWhile = (arr, func) => {
while (arr.length > 0 && !func(arr[0])) arr = arr.slice(1);
return arr;
};
module.exports = dropElements
module.exports = dropWhile