fnif
v1.0.0
Published
Simple functional if statement also known as branch
Downloads
6
Maintainers
Readme
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