Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cond-flow

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cond-flow

Elixir style cond for easy javascript control flow

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
26
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

cond-flow

Inspired bei Elixir's cond (see case-cond-and-if) this is a simpler alternative to _.cond from lodash

code style: prettier JavaScript Style Guide tested with jest

Install

Install with npm or yarn via

yarn add cond-flow

or

npm i cond-flow

Usage

import cond from 'cond-flow'

const value = cond([
  [false, 'false'],
  [true, 'true'],
  [true, 'true but too late']
])

// value === 'true'

You can disable strict checking by passing options as the second argument:

import cond from 'cond-flow'

const value = cond(
  [
    [false, 'false'],
    [1, 'truthy'],
    [true, 'true but also too late']
  ],
  { strict: false }
)

// value === 'truthy'

Development

If you find this useful or would like to add features, feel free to clone the repository and open a PR.

Keywords

FAQs

Package last updated on 20 Mar 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc