static-vars

0.0.2 • Public • Published

Build Status Build Status npm version

NPM

Static Variables

Static variables allows for storing global variables including submodules.

Installation

npm install static-vars --save

Usage

index.js

var staticVars = require('static-vars');
var myVar = staticVars.set('myVar', 'hello world');

other.js

var staticVars = require('static-vars');
if (staticVars.has('myVar')) {
  console.info(staticVars.get('myVar', 'foo bar')); // 'hello world'
}

Methods

get (String name [, Mixed def]) : Mixed

Gets the stored value of a static variable, if the variable is not defined then def will be returned.

set (String name, Mixed value) : Object

Sets the value of a static variable, and returns the static-vars object.

has (String name) : Boolean

Determines if a static variable has been defined.

del (String name) : Object

Deletes the static variable, and returns the static-vars object.

Development and testing

Mocha unit tests:

npm test

ESLint and JSHint:

npm run eslint
npm run jshint

Readme

Keywords

Package Sidebar

Install

npm i static-vars

Weekly Downloads

2

Version

0.0.2

License

none

Last publish

Collaborators

  • orgun109uk