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

1.0.1 • Public • Published

Match Case

Functional pattern matching for typescript

Installation

npm i match-c

Usage

import { match } from "match-c";
 
// Mathces the proper case
const five = match("Hello!!", 10)
    .c("Hola", 2)
    .c("Hello", 100)
    .c("Hello!!", 5)
    .result;
 
// Uses defualt when no match is found
const ten = match("Hello!!", 10)
    .c("Hola", 2)
    .c("Hello", 100)
    .c("Hello!!!!!", 5)
    .result;

Building and Testing

npm test # If no errors occur, the test suite passed 

Dependents (0)

Package Sidebar

Install

npm i match-c

Weekly Downloads

0

Version

1.0.1

License

ISC

Unpacked Size

8.58 kB

Total Files

8

Last publish

Collaborators

  • drew-y