es-toolkit
Version:
A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.
17 lines (14 loc) • 356 B
JavaScript
import { identity } from '../../function/identity.mjs';
function forIn(object, iteratee = identity) {
if (object == null) {
return object;
}
for (const key in object) {
const result = iteratee(object[key], key, object);
if (result === false) {
break;
}
}
return object;
}
export { forIn };