UNPKG

lenye_base

Version:

基础方法

24 lines (18 loc) 518 B
'use strict'; require('./get_tag.js'); require('./is_array.js'); require('./is_string.js'); require('./is_map.js'); require('./is_set.js'); var size = require('./size.js'); /** * Removes elements from the end of an array until the passed function returns true, * Returns the remaining elements in the array. */ function dropRightWhile(arr, func) { var rightIndex = size(arr); while (rightIndex-- && !func(arr[rightIndex])) { } return arr.slice(0, rightIndex + 1); } module.exports = dropRightWhile;