Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

namespaced-constants

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

namespaced-constants

Use consts to declare namespaced constants with some sugar.

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

Namespaced Constants

This is a simple library that allows you to do this:

const FOO = consts('FOO')('BAR', 'BAZ', 'BOP')

FOO.BAR == 'FOO_BAR' //true

It avoids needing to...

const FOO_BAR = 'FOO_BAR'
const FOO_BAZ = 'FOO_BAZ'
const FOO_BOP = 'FOO_BOP'

...Which becomes quite cumbersome with many constants!

Interally, Object.freeze is used, so for all intents and purposes, you can think of objects created with consts as a constant.

FAQs

Package last updated on 14 Apr 2016

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