UNPKG

341 BJavaScriptView Raw
1export const Switch = (patterns, protector = e => e) => (matches, mProtector = e => e) => (...data) => {
2 const keyList = Object.keys(patterns);
3 const normalized = protector(...data);
4 for (const key of keyList) if (patterns[key](normalized)) return mProtector(matches[key]);
5};
6
7export default Switch;
8//# sourceMappingURL=switch.js.map
\No newline at end of file