redux-vertical
Version:
Build redux vertically
19 lines • 946 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const invariant_1 = __importDefault(require("invariant"));
const constants_1 = __importDefault(require("./constants"));
function createTypes(ns, types) {
const delimiter = constants_1.default.delimiter;
invariant_1.default(Array.isArray(types), 'createTypes expected a Array of strings for types, but got %s', types);
invariant_1.default(ns && typeof ns === 'string', 'createTypes expected a string for ns, but got %s', ns);
return types.reduce((acc, type) => {
invariant_1.default(typeof type === 'string', 'expect type to be a string but found %s', type);
acc[type] = ns + delimiter + type;
return acc;
}, {});
}
exports.default = createTypes;
//# sourceMappingURL=create-types.js.map