# fnif

> Simple functional if statement also known as branch

Latest version **1.0.0** (published 2018-01-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install fnif
pnpm add fnif
yarn add fnif
bun add fnif
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-01-08 |
| First published | 2018-01-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Scott Winkelmann |
| Maintainers | scottishcyclops |
| Keywords | functional, if, branch, function, test |

## Links

- npm: https://www.npmjs.com/package/fnif
- Repository: https://github.com/ScottishCyclops/fnif
- Homepage: https://github.com/ScottishCyclops/fnif#readme
- Issues: https://github.com/ScottishCyclops/fnif/issues
- npm.io page: https://npm.io/package/fnif

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads
- [aws-elasticsearch-connector](https://npm.io/package/aws-elasticsearch-connector.md) — 37.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2018-01-08

## README

# FNIF

*Functional if*

Simple functional if statement also known as branch


## Examples

__Simple__

```javascript
const $if = require("fnif")

const i = 10

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


__Complete__

```javascript
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__

```javascript
const $if = require("fnif")

const age = 16

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


__Nesting__

```javascript
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](https://github.com/ScottishCyclops/fnif/issues) ! Thanks

---
_Source: https://npm.io/package/fnif · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
