jupyter-ijavascript-utils 1.16.0 → 1.16.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/object.js +3 -1
package/package.json
CHANGED
package/src/object.js
CHANGED
|
@@ -206,10 +206,12 @@ module.exports.augment = function augment(objCollection, mappingFn, inPlace = fa
|
|
|
206
206
|
*/
|
|
207
207
|
module.exports.mapByProperty = function mapByProperty(collection, propertyName) {
|
|
208
208
|
if (!propertyName) throw new Error('object.mapByProperty: expects a propertyName');
|
|
209
|
+
|
|
210
|
+
const cleanedFunc = ObjectUtils.evaluateFunctionOrProperty(propertyName);
|
|
209
211
|
|
|
210
212
|
return (collection || []).reduce(
|
|
211
213
|
(result, entry) => {
|
|
212
|
-
result.set(entry
|
|
214
|
+
result.set(cleanedFunc(entry), entry);
|
|
213
215
|
return result;
|
|
214
216
|
}, new Map()
|
|
215
217
|
);
|