# fj-ifelse

> Functional ifElse

Latest version **1.1.0** (published 2015-02-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install fj-ifelse
pnpm add fj-ifelse
yarn add fj-ifelse
bun add fj-ifelse
```

## 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.1.0 |
| Published | 2015-02-04 |
| First published | 2015-01-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | schtoeffel, hemanth |
| Keywords | fp-dom, fp, if, else |

## Links

- npm: https://www.npmjs.com/package/fj-ifelse
- Repository: https://github.com/fp-js/fj-ifElse
- Issues: https://github.com/fp-js/fj-ifElse/issues
- npm.io page: https://npm.io/package/fj-ifelse

## Dependencies (1)

- [fj-curry](https://npm.io/package/fj-curry.md) ^1.0.0

## Recent versions

- 1.1.0 (latest) — 2015-02-04
- 1.0.1 — 2015-01-31
- 1.0.0 — 2015-01-31

## README

# fj-ifElse

[![Build Status](https://travis-ci.org/fp-js/fj-ifElse.svg)](https://travis-ci.org/fp-js/fj-ifElse) [![npm version](https://badge.fury.io/js/fj-ifelse.svg)](http://badge.fury.io/js/fj-ifelse)
> Functional ifElse

## Installation

`npm install fj-ifelse --save`

## Usage

```js
var ifElse = require('fj-ifelse');

ifElse(
    (x) => x === true,
    (x) => t.ok(x),
    () => t.fail()
)(true);

var ifTrue = ifElse(() => true);

ifTrue(
    () => t.ok(true),
    () => t.fail()
)();
```


## API

### ifElse

Checks if a predicate returns true and calls the associated function.

`ifElse(predicate, then, otherwise)`

***Parameters***

| Name          | Type        | Description                           |
| ------------- | ----------- | --------------------------            |
| predicate     | function    | Function that returns true or false   |
| then          | function    | Function called if predicate is true  |
| otherwise     | function    | Function called if predicate is false |

***Returns***

| Type        | Description                                     |
| ----------- | --------------------------                      |
| function    | Returns a function wich passes the values to the predicate |

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