LendAndRegret/node_modules/es-toolkit/dist/compat/array/takeRightWhile.js
2026-05-02 17:27:43 +08:00

21 lines
724 B
JavaScript

'use strict';
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const identity = require('../../function/identity.js');
const negate = require('../../function/negate.js');
const toArray = require('../_internal/toArray.js');
const isArrayLikeObject = require('../predicate/isArrayLikeObject.js');
const iteratee = require('../util/iteratee.js');
function takeRightWhile(_array, predicate) {
if (!isArrayLikeObject.isArrayLikeObject(_array)) {
return [];
}
const array = toArray.toArray(_array);
const index = array.findLastIndex(negate.negate(iteratee.iteratee(predicate ?? identity.identity)));
return array.slice(index + 1);
}
exports.takeRightWhile = takeRightWhile;