{"name":"lazy-cache","description":"Cache requires to be lazy-loaded when needed.","version":"0.2.4","homepage":"https://github.com/jonschlinkert/lazy-cache","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"https://github.com/jonschlinkert/lazy-cache"},"bugs":{"url":"https://github.com/jonschlinkert/lazy-cache/issues"},"license":"MIT","files":["index.js","utils.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"devDependencies":{"ansi-yellow":"^0.1.1","glob":"^5.0.14","mocha":"*"},"keywords":["cache","caching","dependencies","dependency","lazy","require","requires"],"verb":{"related":{"list":["lint-deps"]}},"readme":"# lazy-cache [![NPM version](https://badge.fury.io/js/lazy-cache.svg)](http://badge.fury.io/js/lazy-cache)\n\n> Cache requires to be lazy-loaded when needed.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/)\n\n```sh\n$ npm i lazy-cache --save\n```\n\n## Usage\n\n```js\nvar lazy = require('lazy-cache')(require);\n```\n\n**Use as a property on `lazy`**\n\nThe module is also added as a property to the `lazy` function\nso it can be called without having to call a function first.\n\n```js\nvar lazy = require('lazy-cache')(require);\n\n// `npm install glob`\nlazy('glob');\n\n// glob sync\nconsole.log(lazy.glob.sync('*.js'));\n\n// glob async\nlazy.glob('*.js', function (err, files) {\n  console.log(files);\n});\n```\n\n**Use as a function**\n\n```js\nvar lazy = require('lazy-cache')(require);\nvar glob = lazy('glob');\n\n// `glob` is a now a function that may be called when needed\nglob().sync('foo/*.js');\n```\n\n## Aliases\n\nAn alias may be passed as the second argument if you don't want to use the automatically camel-cased variable name.\n\n**Example**\n\n```js\nvar utils = require('lazy-cache')(require);\n\nutils('ansi-yellow', 'yellow');\nconsole.log(utils.yellow('foo'));\n```\n\n## Browserify usage\n\n**Example**\n\n```js\nvar lazy = require('lazy-cache')(require);\n// temporarily re-assign `require` to trick browserify\nvar fn = require;\nrequire = lazy;\n// list module dependencies here (`require` is actually `lazy`)\nrequire('glob');\nrequire = fn; // restore the native `require` function\n\n/**\n * Now you can use glob with the `lazy.glob` variable\n */\n\n// sync\nconsole.log(lazy.glob.sync('*.js'));\n\n// async\nlazy.glob('*.js', function (err, files) {\n  console.log(files.join('\\n'));\n});\n```\n\n## Related\n\n[lint-deps](https://www.npmjs.com/package/lint-deps): CLI tool that tells you when dependencies are missing from package.json and offers you a… [more](https://www.npmjs.com/package/lint-deps) | [homepage](https://github.com/jonschlinkert/lint-deps)\n\n## Running tests\n\nInstall dev dependencies:\n\n```sh\n$ npm i -d && npm test\n```\n\n## Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/lazy-cache/issues/new).\n\n## Author\n\n**Jon Schlinkert**\n\n+ [github/jonschlinkert](https://github.com/jonschlinkert)\n+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)\n\n## License\n\nCopyright © 2015 Jon Schlinkert\nReleased under the MIT license.\n\n***\n\n_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 24, 2015._","readmeFilename":"README.md","_id":"lazy-cache@0.2.4","_shasum":"036a699535217acda4fb2e3fda3fc0916f8db786","_from":"https://registry.npmjs.org/lazy-cache/-/lazy-cache-0.2.4.tgz","_resolved":"https://registry.npmjs.org/lazy-cache/-/lazy-cache-0.2.4.tgz"}