"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.typeToConstructor = typeToConstructor;
exports.mapToTypeMap = mapToTypeMap;

var _util = require("@polkadot/util");

var _create = require("../create");

// Copyright 2017-2019 @polkadot/types authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
function typeToConstructor(type) {
  return (0, _util.isString)(type) ? (0, _create.ClassOf)(type) : type;
}
/**
 * @description takes an input map of the form `{ [string]: string | Constructor }` and returns a map of `{ [string]: Conbstructor }`
 */


function mapToTypeMap(input) {
  const output = {};
  Object.entries(input).forEach((_ref) => {
    let [key, type] = _ref;
    output[key] = typeToConstructor(type);
  });
  return output;
}