1.0.1 • Published 4 years ago
@psdevs/js-utils v1.0.1
js-utils
sumOf(array, ...keys) ⇒ number
Param | Type | Description |
---|---|---|
array | Array.<any> | The array of objects with a shared shallow or nested property. |
...keys | string | The property accessor(s) for the objects in the array. |
Example
const data = [{ nested: { value: 12 } }, { nested: { value: 34 } }];
sumOf(data, "nested", "value"); // 46