base-options
Advanced tools
Comparing version 0.1.3 to 0.3.0
30
index.js
@@ -12,20 +12,22 @@ /*! | ||
module.exports = function(key, value) { | ||
this.options = this.options || {}; | ||
module.exports = function option(app) { | ||
app.mixin('option', function(key, value) { | ||
this.options = this.options || {}; | ||
if (typeof key === 'string') { | ||
if (arguments.length === 1) { | ||
return utils.get(this.options, key); | ||
if (typeof key === 'string') { | ||
if (arguments.length === 1) { | ||
return utils.get(this.options, key); | ||
} | ||
utils.set(this.options, key, value); | ||
this.emit('option', key, value); | ||
return this; | ||
} | ||
utils.set(this.options, key, value); | ||
this.emit('option', key, value); | ||
return this; | ||
} | ||
if (typeof key !== 'object') { | ||
throw new TypeError('expected a string or object.'); | ||
} | ||
if (key == null || typeof key !== 'object') { | ||
throw new TypeError('expected a string or object.'); | ||
} | ||
this.visit('option', key); | ||
return this; | ||
this.visit('option', key); | ||
return this; | ||
}); | ||
}; |
{ | ||
"name": "base-options", | ||
"description": "Adds an `option` method to base-methods.", | ||
"version": "0.1.3", | ||
"version": "0.3.0", | ||
"homepage": "https://github.com/jonschlinkert/base-options", | ||
@@ -24,3 +24,2 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"dependencies": { | ||
"base-methods": "^0.2.10", | ||
"get-value": "^1.2.1", | ||
@@ -31,2 +30,8 @@ "lazy-cache": "^0.2.3", | ||
"devDependencies": { | ||
"base-methods": "^0.2.11", | ||
"gulp": "^3.9.0", | ||
"gulp-istanbul": "^0.10.1", | ||
"gulp-jshint": "^1.11.2", | ||
"gulp-mocha": "^2.1.3", | ||
"jshint-stylish": "^2.0.1", | ||
"mocha": "*" | ||
@@ -33,0 +38,0 @@ }, |
@@ -1,2 +0,2 @@ | ||
# base-options [![NPM version](https://badge.fury.io/js/base-options.svg)](http://badge.fury.io/js/base-options) | ||
# base-options [![NPM version](https://badge.fury.io/js/base-options.svg)](http://badge.fury.io/js/base-options) [![Build Status](https://travis-ci.org/jonschlinkert/base-options.svg)](https://travis-ci.org/jonschlinkert/base-options) | ||
@@ -15,16 +15,11 @@ > Adds an `option` method to base-methods. | ||
Use as a plugin with with your `base` application: | ||
```js | ||
var Base = require('base-methods'); | ||
var option = require('base-options'); | ||
var options = require('base-options'); | ||
// create your application and inherit `Base` | ||
function App() { | ||
Base.call(this); | ||
} | ||
Base.extend(App); | ||
var app = new App(); | ||
var base = new Base(); | ||
base.use(options); // plugin | ||
// add the `option` method to `App` | ||
app.mixin('option', option); | ||
// set/get options | ||
@@ -68,2 +63,2 @@ app.option('foo', 'bar'); | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 02, 2015._ | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 06, 2015._ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5083
3
40
7
62
- Removedbase-methods@^0.2.10
- Removedbase-methods@0.2.14(transitive)
- Removedclass-utils@0.2.3(transitive)
- Removedcollection-visit@0.2.3(transitive)
- Removedcomponent-emitter@1.3.1(transitive)
- Removeddefine-property@0.2.5(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedget-value@2.0.6(transitive)
- Removedhas-value@0.3.1(transitive)
- Removedhas-values@0.1.4(transitive)
- Removedhasown@2.0.2(transitive)
- Removedis-accessor-descriptor@1.0.1(transitive)
- Removedis-buffer@1.1.6(transitive)
- Removedis-data-descriptor@1.0.1(transitive)
- Removedis-descriptor@0.1.7(transitive)
- Removedisarray@1.0.0(transitive)
- Removedisobject@2.1.03.0.1(transitive)
- Removedkind-of@3.2.2(transitive)
- Removedlazy-cache@2.0.2(transitive)
- Removedmap-visit@0.1.5(transitive)
- Removedobject-visit@0.3.4(transitive)
- Removedset-getter@0.1.1(transitive)
- Removedto-object-path@0.3.0(transitive)
- Removedunset-value@0.1.2(transitive)