source: node_modules/es-toolkit/dist/compat/array/takeRightWhile.mjs

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 570 bytes
RevLine 
[a762898]1import { identity } from '../../function/identity.mjs';
2import { negate } from '../../function/negate.mjs';
3import { toArray } from '../_internal/toArray.mjs';
4import { isArrayLikeObject } from '../predicate/isArrayLikeObject.mjs';
5import { iteratee } from '../util/iteratee.mjs';
6
7function takeRightWhile(_array, predicate) {
8 if (!isArrayLikeObject(_array)) {
9 return [];
10 }
11 const array = toArray(_array);
12 const index = array.findLastIndex(negate(iteratee(predicate ?? identity)));
13 return array.slice(index + 1);
14}
15
16export { takeRightWhile };
Note: See TracBrowser for help on using the repository browser.