UNPKG

augmented-array

Version:

Extends Array methods adding: - combine(array): Object - diff(array): Array - indexByKey(arrayOfObjects): objectOfObjects - intersect(array): Array - pluck(field): Array - range(elements): Array - range(begin, end): Array - subtract(array): Array

8 lines (7 loc) 303 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); if (!Array.prototype.combine) { Array.prototype.combine = function combine(array) { return this.reduce((result, field, index) => (Object.assign(Object.assign({}, result), { [field]: array[index] })), {}); }; }