# fluent-switch

> Switch reloaded

Latest version **1.0.2** (published 2019-08-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install fluent-switch
pnpm add fluent-switch
yarn add fluent-switch
bun add fluent-switch
```

## 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.2 |
| Published | 2019-08-06 |
| First published | 2018-12-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Maximilian Krauß |
| Maintainers | maximilian-krauss |
| Keywords | switch, if, fluent |

## Links

- npm: https://www.npmjs.com/package/fluent-switch
- Repository: https://github.com/maximilian-krauss/fluent-switch
- Homepage: https://github.com/maximilian-krauss/fluent-switch#readme
- Issues: https://github.com/maximilian-krauss/fluent-switch/issues
- npm.io page: https://npm.io/package/fluent-switch

## Alternatives

- [update-check](https://npm.io/package/update-check.md) — 4.0M weekly downloads
- [react-native-onesignal](https://npm.io/package/react-native-onesignal.md) — 134.5K weekly downloads
- [react-redux-toastr](https://npm.io/package/react-redux-toastr.md) — 33.7K weekly downloads
- [@nocobase/plugin-notification-manager](https://npm.io/package/@nocobase/plugin-notification-manager.md) — 2.0K weekly downloads
- [react-simple-toasts](https://npm.io/package/react-simple-toasts.md) — 1.9K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2019-08-06
- 1.0.1 — 2019-06-18
- 1.0.0 — 2018-12-12

## README

# FluentSwitch

[![Build Status](https://travis-ci.org/maximilian-krauss/fluent-switch.svg?branch=master)](https://travis-ci.org/maximilian-krauss/fluent-switch)

Better way to do switching.

## Installation

```bash
npm i fluent-switch
```

## Usage

### No fallback

```js
  FluentSwitch
    .createFrom(error)
    .case(e => e instanceof TimeoutError, e => log.error('timeout', e))
    .case(e => e instanceof ConnectionError, () => e => log.error('connection', e))
    .execute()
```

### With fallback

```js
  FluentSwitch
    .createFrom(error)
    .case(e => e instanceof TimeoutError, e => log.error('timeout', e))
    .case(e => e instanceof ConnectionError, () => e => log.error('connection', e))
    .else(e => log.error('Unknown error', e))
    .execute()
```

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