A small library for adding constants to your modules
JavaScript
Latest commit 97ee79b Oct 22, 2014 @dominicbarnes Update README.md
Failed to load latest commit information.
examples
lib
test
.gitignore
LICENSE MIT license, package.json update Apr 15, 2013
README.md Update README.md Oct 22, 2014
index.js
package.json

README.md

node-constants

A small library for defining module-level constants.

Check for further examples in the examples folder. Also, the source code is really small and well documented.

NOTE: newer versions of node use the name "constants" internally, which clobbers any attempt to use this library. As a result, I've had to rename to the more verbose, "node-constants".

Basic Usage

var define = require("node-constants")(exports);
// define is a function that binds "constants" to an object (commonly exports)

// a single constant
define("PI", 3.14);

// or multiple
define({
    DAYS_IN_WEEK: 7,
    SECONDS_IN_MINUTE: 60
});

Installation

$ npm install --save node-constants