mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 07:47:49 +00:00
26 lines
680 B
JavaScript
26 lines
680 B
JavaScript
/**
|
|
* 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
|
|
}
|
|
|
|
export default baseForRight
|