{"name":"base-plugins","description":"Adds 'smart plugin' support to your base application.","version":"1.0.0","homepage":"https://github.com/node-base/base-plugins","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/node-base/base-plugins.git"},"bugs":{"url":"https://github.com/node-base/base-plugins/issues"},"license":"MIT","files":["index.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"define-property":"^0.2.5","is-registered":"^0.1.5","is-valid-instance":"^0.3.0","isobject":"^3.0.0"},"devDependencies":{"base":"^0.11.1","gulp":"^3.9.1","gulp-eslint":"^3.0.1","gulp-format-md":"^0.1.11","gulp-istanbul":"^1.1.1","gulp-mocha":"^3.0.0","mocha":"^3.2.0","should":"^11.2.1","vinyl":"^2.0.1"},"keywords":["api","app","application","base","base-plugin","baseplugin","building-blocks","create","framework","plugin","plugins","tool","toolkit","tools"],"verb":{"related":{"list":["base","base-cli","base-config","base-data","base-fs","base-option"]},"run":true,"toc":false,"layout":"default","tasks":["readme"],"plugins":["gulp-format-md"],"reflinks":["base","verb"],"lint":{"reflinks":true}},"gitHead":"0da424d304f0bcc85c5399094f2a878cdb3e6dc6","_id":"base-plugins@1.0.0","_shasum":"adba200ece18e3f12eb1a53d07eb2d594cf5eeda","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.7.3","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"doowb","email":"brian.woodward@gmail.com"},{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"adba200ece18e3f12eb1a53d07eb2d594cf5eeda","tarball":"http://registry-npm.ywwl.com/base-plugins/download/base-plugins-1.0.0.tgz","integrity":"sha512-h6tFiZQc6yPF3OZCtPwy+nPfT1VzCleDd9ahIZBWC6kWANS1TkN0tgqn0UNrCNIYcvy9kcu9DjuLsd0toFJe7A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG8aMB+d5PalOgO0GgZ/KbiqNSHxNSYlMvrEQxZsbgDoAiEAlEVS1zSirjuExLyaeO+4h6ZQPQSy5lOy2SAoyIXf6I8="}],"size":4174,"noattachment":false,"key":"/base-plugins/-/base-plugins-1.0.0.tgz"},"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/base-plugins-1.0.0.tgz_1491075548596_0.9556328940670937"},"directories":{},"readme":"# base-plugins [![NPM version](https://img.shields.io/npm/v/base-plugins.svg?style=flat)](https://www.npmjs.com/package/base-plugins) [![NPM monthly downloads](https://img.shields.io/npm/dm/base-plugins.svg?style=flat)](https://npmjs.org/package/base-plugins)  [![NPM total downloads](https://img.shields.io/npm/dt/base-plugins.svg?style=flat)](https://npmjs.org/package/base-plugins) [![Linux Build Status](https://img.shields.io/travis/node-base/base-plugins.svg?style=flat&label=Travis)](https://travis-ci.org/node-base/base-plugins)\n\n> Adds 'smart plugin' support to your base application.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save base-plugins\n```\n\n**What does this do?**\n\nThis plugin augments the generic plugin functionality that ships with [base](https://github.com/node-base/base).\n\n* Without this plugin, any plugins that registered with the `use` method and are only called once upon init.\n* With this plugin, other plugins that return a function will be pushed onto a `plugins` array, and can be called again later with the `run` method.\n\n## Usage\n\n```js\nvar plugins = require('base-plugins');\nvar Base = require('base');\nvar base = new Base();\n\n// register the `plugins` plugin\nbase.use(plugins());\n```\n\n## Examples\n\n### .use example\n\nOnce the `use` method is called:\n\n1. a `fns` array is added to the instance for storing plugin functions\n2. a `run` method is added to the instance for running stored plugins\n3. the `use` method is modified so that anytime a function is returned by a plugin, the function will be pushed onto the `fns` array. Aside from that, you shouldn't see any difference in how the `use` method works.\n\n## .run example\n\nThe `run` method iterates over the `fns` array and calls each stored plugin function on the given object.\n\n```js\nvar collection = {};\nbase.use(function(app) {\n  app.x = 'y';\n  return function(obj) {\n    obj.a = 'b';\n  };\n});\nbase.run(collection);\n\nconsole.log(base.x);\n//=> 'y'\nconsole.log(collection.a);\n//=> 'b'\n```\n\n## API\n\n### [.use](index.js#L54)\n\nDefine a plugin function to be called immediately upon init. The only parameter exposed to the plugin is the application instance.\n\nAlso, if a plugin returns a function, the function will be pushed\nonto the `fns` array, allowing the plugin to be called at a\nlater point, elsewhere in the application.\n\n**Params**\n\n* `fn` **{Function}**: plugin function to call\n* `returns` **{Object}**: Returns the item instance for chaining.\n\n**Example**\n\n```js\n// define a plugin\nfunction foo(app) {\n  // do stuff\n}\n\n// register plugins\nvar app = new Base()\n  .use(foo)\n  .use(bar)\n  .use(baz)\n```\n\n### [.run](index.js#L69)\n\nRun all plugins\n\n**Params**\n\n* `value` **{Object}**: Object to be modified by plugins.\n* `returns` **{Object}**: Returns the item instance for chaining.\n\n**Example**\n\n```js\nvar config = {};\napp.run(config);\n```\n\n## About\n\n### Related projects\n\n* [base-cli](https://www.npmjs.com/package/base-cli): Plugin for base-methods that maps built-in methods to CLI args (also supports methods from a… [more](https://github.com/node-base/base-cli) | [homepage](https://github.com/node-base/base-cli \"Plugin for base-methods that maps built-in methods to CLI args (also supports methods from a few plugins, like 'base-store', 'base-options' and 'base-data'.\")\n* [base-config](https://www.npmjs.com/package/base-config): base-methods plugin that adds a `config` method for mapping declarative configuration values to other 'base… [more](https://github.com/node-base/base-config) | [homepage](https://github.com/node-base/base-config \"base-methods plugin that adds a `config` method for mapping declarative configuration values to other 'base' methods or custom functions.\")\n* [base-data](https://www.npmjs.com/package/base-data): adds a `data` method to base-methods. | [homepage](https://github.com/node-base/base-data \"adds a `data` method to base-methods.\")\n* [base-fs](https://www.npmjs.com/package/base-fs): base-methods plugin that adds vinyl-fs methods to your 'base' application for working with the file… [more](https://github.com/node-base/base-fs) | [homepage](https://github.com/node-base/base-fs \"base-methods plugin that adds vinyl-fs methods to your 'base' application for working with the file system, like src, dest, copy and symlink.\")\n* [base-option](https://www.npmjs.com/package/base-option): Adds a few options methods to base, like `option`, `enable` and `disable`. See the readme… [more](https://github.com/node-base/base-option) | [homepage](https://github.com/node-base/base-option \"Adds a few options methods to base, like `option`, `enable` and `disable`. See the readme for the full API.\")\n* [base](https://www.npmjs.com/package/base): Framework for rapidly creating high quality node.js applications, using plugins like building blocks | [homepage](https://github.com/node-base/base \"Framework for rapidly creating high quality node.js applications, using plugins like building blocks\")\n\n### Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n### Building docs\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme && verb\n```\n\n### Running tests\n\nRunning and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:\n\n```sh\n$ npm install && npm test\n```\n\n### Author\n\n**Jon Schlinkert**\n\n* [github/jonschlinkert](https://github.com/jonschlinkert)\n* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)\n\n### License\n\nCopyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.4.3, on April 01, 2017._","publish_time":1491075549314,"_cnpm_publish_time":1491075549314,"dist-tags":{"latest":"1.0.0"}}