UNPKG

434 BJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6const Switch = exports.Switch = (patterns, protector = e => e) => (matches, mProtector = e => e) => (...data) => {
7 const keyList = Object.keys(patterns);
8 const normalized = protector(...data);
9 for (const key of keyList) if (patterns[key](normalized)) return mProtector(matches[key]);
10};
11
12exports.default = Switch;
13//# sourceMappingURL=switch.js.map
\No newline at end of file