@newdash/newdash
Version:
javascript/typescript utility library
26 lines (25 loc) • 795 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/**
* This function is like `baseFor` except that it iterates over properties
* in the opposite order.
*
* @private
* @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`.
* @returns {Object} Returns `object`.
*/
function baseForRight(object, iteratee, keysFunc) {
const iterable = Object(object);
const props = keysFunc(object);
let { length } = props;
while (length--) {
const key = props[length];
if (iteratee(iterable[key], key, iterable) === false) {
break;
}
}
return object;
}
exports.default = baseForRight;