🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
## dropRightWhile + [link](./dropRightWhile "Link to this entry.") + [source](https://github.com/lodash/lodash/blob/4.5.0正式版/lodash.src.js#L5759 "View in source.") + [npm](https://www.npmjs.com/package/lodash.droprightwhile "See the npm package.") ``` _.dropRightWhile(array, [predicate=_.identity]) ``` 从右边开始裁剪数组,起点从 `predicate` 返回假值开始。`predicate` 会传入3个参数:(value, index, array)。 ### 参数 1. array (Array) 需要处理的数组 2. [predicate=_.identity] (Function|Object|string) 这个函数会在每一次迭代调用 ### 返回值 (Array) 返回裁剪后的数组 ### 示例 ``` var resolve = _.partial(_.map, _, 'user'); var users = [ { 'user': 'barney', 'active': true }, { 'user': 'fred', 'active': false }, { 'user': 'pebbles', 'active': false } ]; resolve( _.dropRightWhile(users, function(o) { return !o.active; }) ); // => ['barney'] // 使用了 `_.matches` 的回调结果 resolve( _.dropRightWhile(users, { 'user': 'pebbles', 'active': false }) ); // => ['barney', 'fred'] // 使用了 `_.matchesProperty` 的回调结果 resolve( _.dropRightWhile(users, ['active', false]) ); // => ['barney'] // 使用了 `_.property` 的回调结果 resolve( _.dropRightWhile(users, 'active') ); // => ['barney', 'fred', 'pebbles'] ```