@baravak/array2object
Advanced tools
+1
-1
@@ -1,1 +0,1 @@ | ||
| export declare function Array2Object(array: any[], key: string): Record<string, any>; | ||
| export declare function Array2Object(array: any[], key: string, value?: string): Record<string, any>; |
+2
-2
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.Array2Object = void 0; | ||
| function Array2Object(array, key) { | ||
| function Array2Object(array, key, value) { | ||
| return array.reduce((obj, item) => { | ||
| return { | ||
| ...obj, | ||
| [item[key]]: item | ||
| [item[key]]: value === undefined ? item : item.value | ||
| }; | ||
@@ -10,0 +10,0 @@ }, {}); |
+1
-1
| { | ||
| "name": "@baravak/array2object", | ||
| "version": "1.0.3", | ||
| "version": "1.4.0", | ||
| "description": "Convert array to object", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
870
7.14%