{"name":"base-plugins","description":"Upgrade's plugin support in base-methods to allow plugins to be called any time after init.","version":"0.1.1","homepage":"https://github.com/jonschlinkert/base-plugins","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/base-plugins.git"},"bugs":{"url":"https://github.com/jonschlinkert/base-plugins/issues"},"license":"MIT","files":["index.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"devDependencies":{"base-methods":"^0.2.14","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":"^2.3.3","should":"^7.1.0"},"keywords":["base-methods","base","methods","plugin","plugins"],"verb":{"related":{"list":["base-data","base-options","base-methods"]}},"gitHead":"121a851d34936443881e5d33609fa46d4304d38c","_id":"base-plugins@0.1.1","_shasum":"f1a796881ff7013a9383c68429948490b41b7c14","_from":".","_npmVersion":"2.14.4","_nodeVersion":"4.1.1","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"f1a796881ff7013a9383c68429948490b41b7c14","tarball":"http://registry-npm.ywwl.com/base-plugins/download/base-plugins-0.1.1.tgz","integrity":"sha512-dBAoCpBV9WkhxiBm0+NlyMscnHUMfyeb5Unyba9yyMaiCIsXg846asN4hki/gF85QUw8i1bfRy/EYzSCiTrTDg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGAoVqgTU+ES+0A+49oUXes6GkvQOvIS1VXv6ZhWq1e7AiEAwJDwKrT6SSSzskN2j/Qlap6vDrwiRAhAy98mOHanHFM="}],"size":2770,"noattachment":false,"key":"/base-plugins/-/base-plugins-0.1.1.tgz"},"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":1444272761924,"_cnpm_publish_time":1444272761924,"dist-tags":{"latest":"1.0.0"}}