From 8a51574acf56f4697755327840b5f2930b8598c4 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sat, 15 Apr 2017 22:59:53 -0500 Subject: [PATCH] Rename `mapKeys` and `mapValues` to `mapKey` and `mapValue`. --- mapKeys.js => mapKey.js | 6 +++--- mapValues.js => mapValue.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) rename mapKeys.js => mapKey.js (82%) rename mapValues.js => mapValue.js (92%) diff --git a/mapKeys.js b/mapKey.js similarity index 82% rename from mapKeys.js rename to mapKey.js index 394dc1e20..8ad4b8c20 100644 --- a/mapKeys.js +++ b/mapKey.js @@ -1,7 +1,7 @@ import baseAssignValue from './.internal/baseAssignValue.js' /** - * The opposite of `mapValues` this method creates an object with the + * The opposite of `mapValue` this method creates an object with the * same values as `object` and keys generated by running each own enumerable * string keyed property of `object` thru `iteratee`. The iteratee is invoked * with three arguments: (value, key, object). @@ -14,12 +14,12 @@ import baseAssignValue from './.internal/baseAssignValue.js' * @see mapValues * @example * - * mapKeys({ 'a': 1, 'b': 2 }, function(value, key) { + * mapKey({ 'a': 1, 'b': 2 }, function(value, key) { * return key + value * }) * // => { 'a1': 1, 'b2': 2 } */ -function mapKeys(object, iteratee) { +function mapKey(object, iteratee) { const result = {} Object.keys(object).forEach((value, key, object) => { baseAssignValue(result, iteratee(value, key, object), value) diff --git a/mapValues.js b/mapValue.js similarity index 92% rename from mapValues.js rename to mapValue.js index ec96e59db..9a49776f5 100644 --- a/mapValues.js +++ b/mapValue.js @@ -19,10 +19,10 @@ import baseAssignValue from './.internal/baseAssignValue.js' * 'pebbles': { 'user': 'pebbles', 'age': 1 } * } * - * mapValues(users, ({ age }) => age) + * mapValue(users, ({ age }) => age) * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) */ -function mapValues(object, iteratee) { +function mapValue(object, iteratee) { const result = {} Object.keys(object).forEach((value, key, object) => { baseAssignValue(result, key, iteratee(value, key, object))