lazy-cache
Advanced tools
Comparing version 0.2.3 to 0.2.4
@@ -37,3 +37,3 @@ 'use strict'; | ||
} | ||
}; | ||
} | ||
return getter; | ||
@@ -40,0 +40,0 @@ }; |
{ | ||
"name": "lazy-cache", | ||
"description": "Cache requires to be lazy-loaded when needed.", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"homepage": "https://github.com/jonschlinkert/lazy-cache", | ||
@@ -13,3 +13,4 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"files": [ | ||
"index.js" | ||
"index.js", | ||
"utils.js" | ||
], | ||
@@ -16,0 +17,0 @@ "main": "index.js", |
@@ -56,6 +56,32 @@ # lazy-cache [![NPM version](https://badge.fury.io/js/lazy-cache.svg)](http://badge.fury.io/js/lazy-cache) | ||
```js | ||
var utils = require('lazy-cache')(require); | ||
utils('ansi-yellow', 'yellow'); | ||
console.log(utils.yellow('foo')); | ||
``` | ||
## Browserify usage | ||
**Example** | ||
```js | ||
var lazy = require('lazy-cache')(require); | ||
// temporarily re-assign `require` to trick browserify | ||
var fn = require; | ||
require = lazy; | ||
// list module dependencies here (`require` is actually `lazy`) | ||
require('glob'); | ||
require = fn; // restore the native `require` function | ||
lazy('ansi-yellow', 'yellow'); | ||
console.log(lazy.yellow('foo')); | ||
/** | ||
* Now you can use glob with the `lazy.glob` variable | ||
*/ | ||
// sync | ||
console.log(lazy.glob.sync('*.js')); | ||
// async | ||
lazy.glob('*.js', function (err, files) { | ||
console.log(files.join('\n')); | ||
}); | ||
``` | ||
@@ -65,3 +91,3 @@ | ||
[lint-deps](https://github.com/jonschlinkert/lint-deps): CLI tool that tells you when dependencies are missing from package.json and offers you a… [more](https://github.com/jonschlinkert/lint-deps) | ||
[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) | ||
@@ -78,3 +104,3 @@ ## Running tests | ||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/lazy-cache/issues/new) | ||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/lazy-cache/issues/new). | ||
@@ -95,2 +121,2 @@ ## Author | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on August 19, 2015._ | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 24, 2015._ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5931
118