UNPKG

@discipl/law-reg

Version:

Discipl Law and Regulation Compliance Library

20 lines (18 loc) 418 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.arrayToObject = arrayToObject; /** * Converts an array into an object * * @param {array} arr - array with objects in it * @returns {object} object instead of the given array */ function arrayToObject(arr) { const obj = {}; Object.keys(arr).forEach(element => { Object.assign(obj, arr[element]); }); return obj; }