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

22 lines
495 B
JavaScript

import { identity } from '../../function/identity.mjs';
function forInRight(object, iteratee = identity) {
if (object == null) {
return object;
}
const keys = [];
for (const key in object) {
keys.push(key);
}
for (let i = keys.length - 1; i >= 0; i--) {
const key = keys[i];
const result = iteratee(object[key], key, object);
if (result === false) {
break;
}
}
return object;
}
export { forInRight };