0.1.0 • Published 7 years ago

spacename v0.1.0

Weekly downloads
7
License
CC0-1.0
Repository
github
Last release
7 years ago

#spacename

Namespace your type constants.

license version downloads

Usage

Install:

npm install --save spacename

Define:

import define from `spacename`;

const ns = define('auth');

export const LOGGED_IN = ns('LOGGED_IN'); // auth/LOGGED_IN
export const LOGGED_OUT = ns('LOGGED_OUT'); // auth/LOGGED_OUT

Works great with babel-plugin-filenamespace:

// .babelrc
{
  "plugins": [
    [
      "filenamespace",
      {
        "root": "src",
      }
    ]
  ]
}
// src/action/auth.js
import define from `spacename`;

const ns = define(__filenamespace);

export const LOGGED_IN = ns('LOGGED_IN'); // action/auth/LOGGED_IN
export const LOGGED_OUT = ns('LOGGED_OUT'); // action/auth/LOGGED_OUT
0.1.0

7 years ago