Repository URL to install this package:
|
Version:
1.1.21 ▾
|
"use strict";
/**
* The base implementation of `baseForOwn` which iterates over `object`
* properties returned by `keysFunc` and invokes `iteratee` for each property.
* Iteratee functions may exit iteration early by explicitly returning `false`.
* @since 5.0.0-beta.6
* @memberOf loop
*
* @param {Object} object The object to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {Function} keysFunc The function to get the keys of `object`.
* @return {Object} Returns `object`.
*
*/
function baseFor(object, iteratee, keysFunc) {
const iterable = Object(object);
const props = keysFunc(object);
let length = props.length;
let index = -1;
while (length--) {
const key = props[++index];
if (iteratee(iterable[key], key, iterable) === false) {
break;
}
}
return object;
}
module.exports = baseFor;