Comparing version 1.1.0 to 1.1.1
15
index.js
@@ -20,8 +20,8 @@ /*! | ||
* Define a plugin function to be passed to use. The only | ||
* parameter exposed to the plugin is the application | ||
* instance. | ||
* parameter exposed to the plugin is `app`, the object or function. | ||
* passed to `use(app)`. `app` is also exposed as `this` in plugins. | ||
* | ||
* Also, if a plugin returns a function, the function will be pushed | ||
* onto the `fns` array, allowing the plugin to be called at a | ||
* later point, elsewhere in the application. | ||
* Additionally, **if a plugin returns a function, the function will | ||
* be pushed onto the `fns` array**, allowing the plugin to be | ||
* called at a later point by the `run` method. | ||
* | ||
@@ -46,3 +46,2 @@ * ```js | ||
* @param {Function} `fn` plugin function to call | ||
* @return {Object} Returns the item instance for chaining. | ||
* @api public | ||
@@ -63,3 +62,3 @@ */ | ||
* @param {Object} `value` Object to be modified by plugins. | ||
* @return {Object} Returns the item instance for chaining. | ||
* @return {Object} Returns the object passed to `run` | ||
* @api public | ||
@@ -72,3 +71,3 @@ */ | ||
while (++i < len) val.use(this.fns[i]); | ||
return this; | ||
return val; | ||
}); | ||
@@ -75,0 +74,0 @@ |
{ | ||
"name": "use", | ||
"description": "Easily add plugin support to your node.js application.", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"homepage": "https://github.com/jonschlinkert/use", | ||
@@ -32,4 +32,3 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"gulp-mocha": "^2.1.3", | ||
"mocha": "*", | ||
"should": "*" | ||
"mocha": "*" | ||
}, | ||
@@ -36,0 +35,0 @@ "verb": { |
@@ -5,2 +5,4 @@ # use [![NPM version](https://badge.fury.io/js/use.svg)](http://badge.fury.io/js/use) | ||
A different take on plugin handling! This is not a middleware system, if you need something that handles async middleware, [ware](https://github.com/segmentio/ware) is great for that. | ||
## Install | ||
@@ -20,11 +22,13 @@ | ||
See the [examples folder](./examples) for usage examples. | ||
## API | ||
### [.use](index.js#L49) | ||
### [.use](index.js#L48) | ||
Define a plugin function to be passed to use. The only parameter exposed to the plugin is the application instance. | ||
Define a plugin function to be passed to use. The only parameter exposed to the plugin is `app`, the object or function. passed to `use(app)`. `app` is also exposed as `this` in plugins. | ||
Also, if a plugin returns a function, the function will be pushed | ||
onto the `fns` array, allowing the plugin to be called at a | ||
later point, elsewhere in the application. | ||
Additionally, **if a plugin returns a function, the function will | ||
be pushed onto the `fns` array**, allowing the plugin to be | ||
called at a later point by the `run` method. | ||
@@ -34,3 +38,2 @@ **Params** | ||
* `fn` **{Function}**: plugin function to call | ||
* `returns` **{Object}**: Returns the item instance for chaining. | ||
@@ -56,3 +59,3 @@ **Example** | ||
### [.run](index.js#L65) | ||
### [.run](index.js#L64) | ||
@@ -64,3 +67,3 @@ Run all plugins on `fns`. Any plugin that returns a function when called by `use` is pushed onto the `fns` array. | ||
* `value` **{Object}**: Object to be modified by plugins. | ||
* `returns` **{Object}**: Returns the item instance for chaining. | ||
* `returns` **{Object}**: Returns the object passed to `run` | ||
@@ -67,0 +70,0 @@ **Example** |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
6573
6
103
0
83