Functional enum type for javascript with pattern matching
Read more about SumTypes using EnumFP in this blog post
To add this package to your project
yarn add enum-fpOr if you are one of those npm or pnpm nuts
npm i --save enum-fppnpm i --save enum-fpImport it to your file
import Enum from 'enum-fp';const Action = Enum([ 'Add', 'Edit', 'Delete', 'Get' ]);
// Or with a fixed number of arguments
const Maybe = Enum({
Just: [ 'value' ],
Nothing: [],
});const action = Action.Edit(2, 'Hello world');