Socket
Book a DemoInstallSign in
Socket

actiontypes

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

actiontypes

Generate namespaced strings for Flux standard actions

Source
npmnpm
Version
0.2.1
Version published
Weekly downloads
3
-95.31%
Maintainers
1
Weekly downloads
 
Created
Source

actiontypes

A dead simple a bit opinionated utility to generate namespaced strings for Flux standard actions.

Usage

Basic

import actionTypes from 'actiontypes';

const actions = actionTypes(
  'simple',
  'HELLO',
  'THERE'
);

You'll got:

console.log(actions);
{
  HELLO: 'simple/HELLO',
  THERE: 'simple/THERE'
}

Configuration

import actionTypes from 'actiontypes';

const actions = actionTypes(
    'namespace', // Mandatory
    'OPEN', // At least one string must be provided
    'CLOSE',
    'close', // Skips duplicates
    'tYPO', // Forces uppercase
    'TOGGLE',
    {
       prefix: '@@', // Optional. Prepends to all strings. Default is `''`.
       delimeter: '--', // Optional. Separator between namespace and short form. Default is `/`.
    }
);

And you'll got:

console.log(actions);
{
  OPEN: '@@namespace--OPEN',
  CLOSE: '@@namespace--CLOSE',
  TYPO: '@@namespace--TYPO',
  TOGGLE: '@@namespace--TOGGLE'
}

Keywords

flux

FAQs

Package last updated on 11 Jan 2018

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