@pennah/iffy
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

Javascript "if / else" expressions

Extremely small and type safe.

Installation

NPM

$ npm add @pennah/iffy

Yarn

$ yarn add @pennah/iffy

Usage

Simple expressions

import { If } from "@pennah/iffy";

let powerLevel = 9001;

let message = If(powerLevel > 9000, {
  then: `It's over 9000!!!111`,
  else: `You are no match for me`,
});

console.log(message); // It's over 9000!!!111

Nested expressions

import { If } from "@pennah/iffy";

...

const action = If(userInput === "0", {
  then: () => console.log("Hello"!),
  else: If(userInput === "1" {
    then: () => console.log('Howdy!'),
    else: () => console.log(`It's fine 🐶 🔥`)
  })
});

Contributing

Feel free to open issues or pull requests.

License

Iffy uses an MIT license.

Package Sidebar

Install

npm i @pennah/iffy

Weekly Downloads

2

Version

1.0.2

License

MIT

Unpacked Size

8.56 kB

Total Files

13

Last publish

Collaborators

  • anthonypenna