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

@action-land/match

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@action-land/match

Switch case for actions

  • 8.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
799
decreased by-45.79%
Maintainers
1
Weekly downloads
 
Created
Source

@action-land/match

A switch case for actions.

Installation

npm i @action-land/match

Usage

Exposes a single match() function that —

  1. Accepts two arguments — default and spec.
  2. default is a function that accepts the action and can return anything.
  3. spec is an object where key is action.type and value is a function.
  4. On a successful match of action.type the corresponding function is called with the action.value.
import {action} from '@action-land/core'
import {match} from '@action-land/match'

const fn = match(i => i, {
  inc: i => i + 1,
  dec: i => i - 1
})

fn(action('inc', 10)) // returns 11

FAQs

Package last updated on 22 Aug 2019

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