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

15 lines
458 B
JavaScript

import { takeRight as takeRight$1 } from '../../array/takeRight.mjs';
import { toArray } from '../_internal/toArray.mjs';
import { isArrayLike } from '../predicate/isArrayLike.mjs';
import { toInteger } from '../util/toInteger.mjs';
function takeRight(arr, count = 1, guard) {
count = guard ? 1 : toInteger(count);
if (count <= 0 || !isArrayLike(arr)) {
return [];
}
return takeRight$1(toArray(arr), count);
}
export { takeRight };