Skip to content

A library for writing if / else if / else in a functional way.

License

Notifications You must be signed in to change notification settings

parker-codes/functional-conditionals

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Functional Conditionals

A library for writing if / else if / else in a functional way.


Usage

const age = 12;
const isOldEnough = age >= 18;

const phrase = _if(
  isOldEnough,
  _then('Welcome to the club!'),
  _else('Scram, kid!')
);

expect(phrase).toBe('Scram, kid!');

This will cause a type error because all arms need to match types:

const name = _if(userExists, _then(user.name), _else(25));

This project was bootstrapped with TSDX.

About

A library for writing if / else if / else in a functional way.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published