"use strict";

exports.__esModule = true;
exports["default"] = arrayToObjWithIds;
var _shortid = _interopRequireDefault(require("shortid"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
//get converted to objects with unique ids
function arrayToObjWithIds(array) {
  var newObj = {};
  array.forEach(function (item) {
    var newItem = _extends({}, item, {
      id: item.id || (0, _shortid["default"])()
    });
    newObj[newItem.id] = newItem;
  });
  return newObj;
}
module.exports = exports.default;