17 lines
356 B
JavaScript
17 lines
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 };
|