sweetch
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

sweetch 🎛

Switch as a function, you will be able to use it everywhere, mostly when native switch will produce syntax errors.

import sweetch from "sweetch";

const result = sweetch(
  key,
  ["a", 1],
  ["b", 2],
  ["c", 3],
  ["d", 4],
  ["e", 5],
  "default"
);

// if key === "a" result will be 1

Readme

Keywords

none

Package Sidebar

Install

npm i sweetch

Weekly Downloads

2

Version

0.0.2

License

MIT

Unpacked Size

1.55 kB

Total Files

4

Last publish

Collaborators

  • didierfranc