Socket
Book a DemoInstallSign in
Socket

options-cache

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

options-cache

Get and set options. Easy to use options cache for node.js projects.

Source
npmnpm
Version
0.1.1
Version published
Weekly downloads
14
55.56%
Maintainers
1
Weekly downloads
 
Created
Source

options-cache NPM version

Get and set options. Easy to use options cache for node.js projects.

Install

Install with npm:

npm i options-cache --save-dev

API

index

Initialize a new Options cache.

Example:

In your application:

var util = require('util');
var Options = require('options-cache');

function App(options) {
  Options.call(this, options);
}
util.inherits(App, Options);

App.prototype.foo = function(value) {
  this.enable(value);
};

App.prototype.bar = function(value) {
  if (this.enabled(value)) {
    // do something
  }
};
  • options: {Object}

.option

Set or get an option.

app.option('a', true)
app.option('a')
// => true
  • key: {String}

  • value: {*}

.set

Assign value to key or return the value of key.

app.set('foo', true)
  • key: {String}

  • value: {*} The value to set.

.get

Return the stored value of key.

app.set('foo', true)
app.get('foo')
//=> true
  • key: {String}

.enabled

Check if key is enabled (truthy).

app.enabled('foo')
// => false

app.enable('foo')
app.enabled('foo')
// => true
  • key: {String}

.disabled

Check if key is disabled (falsey).

app.disabled('foo')
// => true

app.enable('foo')
app.disabled('foo')
// => false
  • key: {String}

.enable

Enable key.

Example

app.enable('foo')
  • key: {String}

.disable

Disable key.

Example

app.disable('foo')
  • key: {String} The option to disable.

Author

Jon Schlinkert

License

Copyright (c) 2014 Jon Schlinkert, contributors.
Released under the MIT license

This file was generated by verb-cli on August 09, 2014.

Keywords

node.js

FAQs

Package last updated on 09 Aug 2014

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