UNPKG

lenye_base

Version:

基础方法

18 lines (13 loc) 320 B
'use strict'; /** * Removes elements in an array until the passed function returns true. * Returns the remaining elements in the array. */ function dropWhile(arr, func) { var _arr = arr; while (_arr.length > 0 && !func(_arr[0])) { _arr = _arr.slice(1); } return _arr; } module.exports = dropWhile;