options-cache
Simple API for managing options in JavaScript applications.
Install
npm
Install withnpm i options-cache --save
API
Options
Create a new instance of Options
.
options
{Object}: Initialize with default options.
Example:
var util = ;var Options = ; { Options;}util; Appprototype { this;}; Appprototype { if this // do something };
.option
Set or get an option.
key
{String}: The option name.value
{*}: The value to set.returns
{*}: Returns avalue
when onlykey
is defined.
app;app;//=> true
.enabled
Check if key
is enabled (truthy).
key
{String}returns
: {Boolean}
app;//=> false app;app;//=> true
.disabled
Check if key
is disabled (falsey).
key
{String}returns
{Boolean}: Returns true ifkey
is disabled.
appdisabled'a';//=> true app;appdisabled'a';//=> false
.enable
Enable key
.
key
{String}returns
{Object}Options
: to enable chaining
Example
app;
.disable
Disable key
.
key
{String}: The option to disable.returns
{Object}Options
: to enable chaining
Example
app;
Author
Jon Schlinkert
License
Copyright (c) 2014 Jon Schlinkert, contributors.
Released under the MIT license
This file was generated by verb-cli on October 11, 2014.