1.2.1 • Published 6 years ago

store-settings v1.2.1

Weekly downloads
4
License
ISC
Repository
github
Last release
6 years ago

Express Compatible Settings Store

NPM Version NPM Downloads Build Status Standard - JavaScript Style Guide

A stand-alone implementation of the settings portion of express. The class that is exported can be mixed into or extended from in your application.

Usage

$ npm install --save store-settings
var Settings = require('store-settings');

// Create a store
var store = new Settings();

// Set values on the store
store.set('foo', 'bar');

// Get a value
store.get('foo'); // 'bar'

// Boolean values
store.enable('yep');
store.enabled('yep'); // true
store.disabled('yep'); // false

store.disable('yep');
store.disabled('yep'); // true
store.enabled('yep'); // false

// Setter methods
var store2 = new Settings({
	setters: {
		foo: function (val) {
			this.set('foobar', 'foo' + val);
		}
	}
});
store2.set('foo', 'bar');
store.get('foobar'); // 'foobar'

// Extending from
class Foo extends Settings {
	foo () {
		return this.get('foo');
	}
}

var foo = new Foo();
foo.set('foo', 'bar');
foo.foo(); // 'bar'
1.2.1

6 years ago

1.2.0

7 years ago

1.1.0

8 years ago

1.0.0

8 years ago