diff --git a/filterObject.js b/filterObject.js index 3bcd0ef74..190e82bad 100644 --- a/filterObject.js +++ b/filterObject.js @@ -19,7 +19,8 @@ function filterObject(object, predicate) { const result = [] Object.keys(Object(object)).forEach((key) => { - if (predicate(object[key], key, object)) { + const value = object[key] + if (predicate(value, key, object)) { result.push(value) } }) diff --git a/mapKey.js b/mapKey.js index d2488c9ae..7405a2ccc 100644 --- a/mapKey.js +++ b/mapKey.js @@ -9,7 +9,7 @@ * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Object} Returns the new mapped object. - * @see mapValues + * @see mapValue * @example * * mapKey({ 'a': 1, 'b': 2 }, function(value, key) { @@ -26,4 +26,4 @@ function mapKey(object, iteratee) { return result } -export default mapKeys +export default mapKey diff --git a/mapObject.js b/mapObject.js index 96c24ae86..a817ca729 100644 --- a/mapObject.js +++ b/mapObject.js @@ -17,7 +17,7 @@ * // => [16, 64] (iteration order is not guaranteed) */ function mapObject(object, iteratee) { - const props = Object.keys(object); + const props = Object.keys(object) const result = new Array(props.length) props.forEach((key, index) => { diff --git a/mapValue.js b/mapValue.js index 31e0c1dde..e7820ce99 100644 --- a/mapValue.js +++ b/mapValue.js @@ -23,9 +23,9 @@ function mapValue(object, iteratee) { const result = {} Object.keys(Object(object)).forEach((key) => { - result[key] = iteratee(object[value], key, object) + result[key] = iteratee(object[key], key, object) }) return result } -export default mapValues +export default mapValue