first commit
This commit is contained in:
36
build/node_modules/lazy-req/index.js
generated
vendored
Normal file
36
build/node_modules/lazy-req/index.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
'use strict';
|
||||
module.exports = function (fn) {
|
||||
return function (id) {
|
||||
var mod;
|
||||
|
||||
return function () {
|
||||
if (!arguments.length) {
|
||||
mod = lazy(mod, fn, id);
|
||||
return mod;
|
||||
}
|
||||
|
||||
var ret = {};
|
||||
|
||||
[].forEach.call(arguments, function (prop) {
|
||||
Object.defineProperty(ret, prop, {
|
||||
get: function () {
|
||||
mod = lazy(mod, fn, id);
|
||||
if (typeof mod[prop] === 'function') {
|
||||
return function () {
|
||||
return mod[prop].apply(mod, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
return mod[prop];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return ret;
|
||||
};
|
||||
};
|
||||
|
||||
function lazy(mod, fn, id) {
|
||||
return mod !== undefined ? mod : fn(id);
|
||||
}
|
||||
};
|
||||
21
build/node_modules/lazy-req/license
generated
vendored
Normal file
21
build/node_modules/lazy-req/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
76
build/node_modules/lazy-req/package.json
generated
vendored
Normal file
76
build/node_modules/lazy-req/package.json
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"lazy-req@1.1.0",
|
||||
"/Users/asciidisco/Desktop/asciidisco.com/build"
|
||||
]
|
||||
],
|
||||
"_from": "lazy-req@1.1.0",
|
||||
"_id": "lazy-req@1.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-va6+rTD42CQDnODOFJ1Nqge6H6w=",
|
||||
"_location": "/lazy-req",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "lazy-req@1.1.0",
|
||||
"name": "lazy-req",
|
||||
"escapedName": "lazy-req",
|
||||
"rawSpec": "1.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/bin-wrapper"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/lazy-req/-/lazy-req-1.1.0.tgz",
|
||||
"_spec": "1.1.0",
|
||||
"_where": "/Users/asciidisco/Desktop/asciidisco.com/build",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "http://sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/lazy-req/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Jorge Bucaran",
|
||||
"email": "jbucaran@me.com"
|
||||
}
|
||||
],
|
||||
"description": "Require modules lazily",
|
||||
"devDependencies": {
|
||||
"ava": "0.0.4",
|
||||
"xo": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/lazy-req#readme",
|
||||
"keywords": [
|
||||
"require",
|
||||
"load",
|
||||
"module",
|
||||
"modules",
|
||||
"lazy",
|
||||
"lazily",
|
||||
"defer",
|
||||
"deferred"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "lazy-req",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/lazy-req.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && node test.js"
|
||||
},
|
||||
"version": "1.1.0"
|
||||
}
|
||||
44
build/node_modules/lazy-req/readme.md
generated
vendored
Normal file
44
build/node_modules/lazy-req/readme.md
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
# lazy-req [](https://travis-ci.org/sindresorhus/lazy-req)
|
||||
|
||||
> Require modules lazily
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save lazy-req
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
// pass in `require` or a custom require function
|
||||
var lazyReq = require('lazy-req')(require);
|
||||
var _ = lazyReq('lodash');
|
||||
|
||||
// where you would normally do
|
||||
_.isNumber(2);
|
||||
|
||||
// you now instead call it as a function
|
||||
_().isNumber(2);
|
||||
|
||||
// it's cached on consecutive calls
|
||||
_().isString('unicorn');
|
||||
|
||||
// extract lazy variations of the props you need
|
||||
var members = lazyReq('lodash')('isNumber', 'isString');
|
||||
|
||||
// useful when using destructuring assignment in ES2015
|
||||
const { isNumber, isString } = lazyReq('lodash')('isNumber', 'isString');
|
||||
|
||||
// works out of the box for functions and regular properties
|
||||
var stuff = lazyReq('./math-lib')('sum', 'PHI');
|
||||
console.log(stuff.sum(1, 2)); // => 3
|
||||
console.log(stuff.PHI); // => 1.618033
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
||||
Reference in New Issue
Block a user