kempo 1.1.4 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/utils/object.js +10 -1
package/package.json
CHANGED
package/src/utils/object.js
CHANGED
|
@@ -173,6 +173,14 @@ export const diff = (obj1, obj2) => {
|
|
|
173
173
|
return result;
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
+
export const mapObject = (obj, func) => {
|
|
177
|
+
return Object.entries(obj).reduce((newObj, [key, value]) => {
|
|
178
|
+
const [newKey, newValue] = func(key, value);
|
|
179
|
+
newObj[newKey] = newValue;
|
|
180
|
+
return newObj;
|
|
181
|
+
}, {});
|
|
182
|
+
}
|
|
183
|
+
|
|
176
184
|
export default {
|
|
177
185
|
toJson,
|
|
178
186
|
flattenObject,
|
|
@@ -185,5 +193,6 @@ export default {
|
|
|
185
193
|
prune,
|
|
186
194
|
getAllKeys,
|
|
187
195
|
getDifferencesKeys,
|
|
188
|
-
diff
|
|
196
|
+
diff,
|
|
197
|
+
mapObject
|
|
189
198
|
};
|