{"name":"is-valid-instance","description":"Returns true if a value is a valid instance of Base.","version":"0.1.0","homepage":"https://github.com/jonschlinkert/is-valid-instance","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/is-valid-instance.git"},"bugs":{"url":"https://github.com/jonschlinkert/is-valid-instance/issues"},"license":"MIT","files":["index.js","utils.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"isobject":"^2.1.0","pascalcase":"^0.1.1"},"devDependencies":{"base":"^0.8.1","gulp-format-md":"^0.1.9","mocha":"^2.4.5","templates":"^0.17.2","vinyl":"^1.1.1"},"keywords":["app","base","instance","valid"],"verb":{"layout":"default","plugins":["gulp-format-md"],"related":{"list":["base","base-app"]},"reflinks":["verb"]},"gitHead":"7e867edbbb7ab99f6a37dfb6ddbf58f221f007b6","_id":"is-valid-instance@0.1.0","_shasum":"7ad5c6a3886dfdf7d9cc78049ceff2171a9907b3","_from":".","_npmVersion":"3.6.0","_nodeVersion":"5.5.0","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"7ad5c6a3886dfdf7d9cc78049ceff2171a9907b3","tarball":"http://registry-npm.ywwl.com/is-valid-instance/download/is-valid-instance-0.1.0.tgz","integrity":"sha512-js5DRu650+u3zcGfCe23npdFtPuBeLx3iR8q2vfCO4m1KqNz5R35fDQlLPm++gAzg5H+OJXDOG5LGyn8pzl/1Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEDL0IToZKkw5z1e8d1SZy/e930vLEJ54xxTGkj0h0W6AiBWCoSdLxdLqsUotaXqrWt+PNbD5fEH+NoAxm91YrRc8Q=="}],"size":3123,"noattachment":false,"key":"/is-valid-instance/-/is-valid-instance-0.1.0.tgz"},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/is-valid-instance-0.1.0.tgz_1463316432925_0.5254169336985797"},"directories":{},"readme":"# is-valid-instance [![NPM version](https://img.shields.io/npm/v/is-valid-instance.svg?style=flat)](https://www.npmjs.com/package/is-valid-instance) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-valid-instance.svg?style=flat)](https://npmjs.org/package/is-valid-instance)  [![NPM total downloads](https://img.shields.io/npm/dt/is-valid-instance.svg?style=flat)](https://npmjs.org/package/is-valid-instance) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/is-valid-instance.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/is-valid-instance)\n\n> Returns true if a value is a valid instance of Base.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save is-valid-instance\n```\n\n## Usage\n\nUse in your [base](https://github.com/node-base/base) plugin to ensure that the plugin is registered on a valid instance.\n\n```js\nvar isValidInstance = require('is-valid-instance');\n\nfunction plugin(app) {\n  if (!isValidInstance(app)) return;\n  // do plugin stauff\n}\n```\n\n## API\n\n**Params**\n\n* `val` **{Object}**\n* `names` **{Array|Function}**: One or more names to check for on the given instance. Example `app` will check for `app.isApp === true` or `app._name === 'app'`.\n* `fn` **{Function}**: Custom function for validating the instance.\n* `returns` **{Boolean}**\n\n**Example**\n\n```js\nfunction plugin(app) {\n  if (!isValidInstance(app)) return;\n  // do plugin stuff\n}\n```\n\n## Examples\n\n**Collection instance**\n\nReturn true if the instance is a [templates](https://github.com/jonschlinkert/templates) view-collection (`views`):\n\n```js\nfunction plugin(collection) {\n  if (!isValidInstance(collection, ['views'])) {\n    // optionally return the plugin function so the plugin is re-tried on \n    // each instance until it finds the correct one\n    return plugin;\n  }\n  // do plugin stauff\n}\n```\n\n**View instance**\n\nReturn true if the instance is a [templates](https://github.com/jonschlinkert/templates) view:\n\n```js\nfunction plugin(view) {\n  if (!isValidInstance(view, ['view'])) {\n    return plugin;\n  }\n  // do plugin stauff\n}\n```\n\n**View instance**\n\nReturn true if the instance is either \"app\" or \"collection\":\n\n```js\nfunction plugin(app) {\n  if (!isValidInstance(app, ['app', 'collection'])) {\n    return plugin;\n  }\n  // do plugin stauff\n}\n```\n\n## About\n\n### Related projects\n\n* [base-app](https://www.npmjs.com/package/base-app): Starting point for creating a base application, with a few light plugins for running tasks… [more](https://github.com/node-base/base-app) | [homepage](https://github.com/node-base/base-app \"Starting point for creating a base application, with a few light plugins for running tasks and writing to the file system, and a functional CLI.\")\n* [base-plugins](https://www.npmjs.com/package/base-plugins): Upgrade's plugin support in base applications to allow plugins to be called any time after… [more](https://github.com/node-base/base-plugins) | [homepage](https://github.com/node-base/base-plugins \"Upgrade's plugin support in base applications to allow plugins to be called any time after init.\")\n* [base](https://www.npmjs.com/package/base): base is the foundation for creating modular, unit testable and highly pluggable node.js applications, starting… [more](https://github.com/node-base/base) | [homepage](https://github.com/node-base/base \"base is the foundation for creating modular, unit testable and highly pluggable node.js applications, starting with a handful of common methods, like `set`, `get`, `del` and `use`.\")\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 March 24, 2017._","publish_time":1463316434840,"_cnpm_publish_time":1463316434840,"dist-tags":{"latest":"0.3.0"}}