Socket
Socket
Sign inDemoInstall

use

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

use - npm Package Compare versions

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**

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc