UNPKG

bbo

Version:

bbo is a utility library of zero dependencies for javascript.

22 lines (17 loc) 485 B
import './get_tag.js'; import './is_array.js'; import './is_string.js'; import './is_map.js'; import './is_set.js'; import size from './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); } export default dropRightWhile;