1.0.0 • Published 6 years ago

fnif v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

FNIF

Functional if

Simple functional if statement also known as branch

Examples

Simple

const $if = require("fnif")

const i = 10

$if(i > 5, () =>
{
    console.log("It is greater than 5 !")
})

Complete

const $if = require("fnif")

const i = 10

$if(i > 5, () =>
{
    console.log("It is greater than 5 !")
}, () =>
{
    console.error("Oh no ! it isn't greater than 5")
})

Actual use case

const $if = require("fnif")

const age = 16

const denomination = $if(age >= 18, () => "major", () => "minor")

Nesting

const $if = require("fnif")

const age = 16

const denomination = $if(age >= 18,
    () => "major",
    () => $if(age >= 16,
        () => "not too young",
        () => "minor"))

Please report any issues on Github ! Thanks