aboutsummaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/update-notifier/node_modules/lazy-req
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/update-notifier/node_modules/lazy-req')
-rw-r--r--deps/npm/node_modules/update-notifier/node_modules/lazy-req/index.js53
-rw-r--r--deps/npm/node_modules/update-notifier/node_modules/lazy-req/license21
-rw-r--r--deps/npm/node_modules/update-notifier/node_modules/lazy-req/package.json111
-rw-r--r--deps/npm/node_modules/update-notifier/node_modules/lazy-req/readme.md64
4 files changed, 249 insertions, 0 deletions
diff --git a/deps/npm/node_modules/update-notifier/node_modules/lazy-req/index.js b/deps/npm/node_modules/update-notifier/node_modules/lazy-req/index.js
new file mode 100644
index 0000000000..307f08f393
--- /dev/null
+++ b/deps/npm/node_modules/update-notifier/node_modules/lazy-req/index.js
@@ -0,0 +1,53 @@
+'use strict';
+const lazy = (mod, fn, id) => mod === undefined ? fn(id) : mod;
+
+module.exports = fn => {
+ return id => {
+ let mod;
+
+ return function () {
+ if (arguments.length === 0) {
+ mod = lazy(mod, fn, id);
+ return mod;
+ }
+
+ const ret = {};
+
+ [].forEach.call(arguments, prop => {
+ Object.defineProperty(ret, prop, {
+ get: () => {
+ mod = lazy(mod, fn, id);
+ if (typeof mod[prop] === 'function') {
+ return function () {
+ return mod[prop].apply(mod, arguments);
+ };
+ }
+
+ return mod[prop];
+ }
+ });
+ });
+
+ return ret;
+ };
+ };
+};
+
+module.exports.proxy = fn => {
+ return id => {
+ let mod;
+
+ const handler = {
+ get: (target, property) => {
+ mod = lazy(mod, fn, id);
+ return Reflect.get(mod, property);
+ },
+ apply: (target, thisArg, argumentsList) => {
+ mod = lazy(mod, fn, id);
+ return Reflect.apply(mod, thisArg, argumentsList);
+ }
+ };
+
+ return new Proxy(() => {}, handler);
+ };
+};
diff --git a/deps/npm/node_modules/update-notifier/node_modules/lazy-req/license b/deps/npm/node_modules/update-notifier/node_modules/lazy-req/license
new file mode 100644
index 0000000000..654d0bfe94
--- /dev/null
+++ b/deps/npm/node_modules/update-notifier/node_modules/lazy-req/license
@@ -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.
diff --git a/deps/npm/node_modules/update-notifier/node_modules/lazy-req/package.json b/deps/npm/node_modules/update-notifier/node_modules/lazy-req/package.json
new file mode 100644
index 0000000000..a3a7f6915e
--- /dev/null
+++ b/deps/npm/node_modules/update-notifier/node_modules/lazy-req/package.json
@@ -0,0 +1,111 @@
+{
+ "_args": [
+ [
+ {
+ "raw": "lazy-req@^2.0.0",
+ "scope": null,
+ "escapedName": "lazy-req",
+ "name": "lazy-req",
+ "rawSpec": "^2.0.0",
+ "spec": ">=2.0.0 <3.0.0",
+ "type": "range"
+ },
+ "/Users/ceej/code/Tools/npm/node_modules/update-notifier"
+ ]
+ ],
+ "_from": "lazy-req@>=2.0.0 <3.0.0",
+ "_id": "lazy-req@2.0.0",
+ "_inCache": true,
+ "_location": "/update-notifier/lazy-req",
+ "_nodeVersion": "4.6.2",
+ "_npmOperationalInternal": {
+ "host": "packages-12-west.internal.npmjs.com",
+ "tmp": "tmp/lazy-req-2.0.0.tgz_1484646276710_0.28619852592237294"
+ },
+ "_npmUser": {
+ "name": "sindresorhus",
+ "email": "sindresorhus@gmail.com"
+ },
+ "_npmVersion": "2.15.11",
+ "_phantomChildren": {},
+ "_requested": {
+ "raw": "lazy-req@^2.0.0",
+ "scope": null,
+ "escapedName": "lazy-req",
+ "name": "lazy-req",
+ "rawSpec": "^2.0.0",
+ "spec": ">=2.0.0 <3.0.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/update-notifier"
+ ],
+ "_resolved": "https://registry.npmjs.org/lazy-req/-/lazy-req-2.0.0.tgz",
+ "_shasum": "c9450a363ecdda2e6f0c70132ad4f37f8f06f2b4",
+ "_shrinkwrap": null,
+ "_spec": "lazy-req@^2.0.0",
+ "_where": "/Users/ceej/code/Tools/npm/node_modules/update-notifier",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "bugs": {
+ "url": "https://github.com/sindresorhus/lazy-req/issues"
+ },
+ "contributors": [
+ {
+ "name": "Jorge Bucaran",
+ "email": "jbucaran@me.com"
+ }
+ ],
+ "dependencies": {},
+ "description": "Require modules lazily",
+ "devDependencies": {
+ "ava": "*",
+ "xo": "*"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "c9450a363ecdda2e6f0c70132ad4f37f8f06f2b4",
+ "tarball": "https://registry.npmjs.org/lazy-req/-/lazy-req-2.0.0.tgz"
+ },
+ "engines": {
+ "node": ">=4"
+ },
+ "files": [
+ "index.js"
+ ],
+ "gitHead": "498395dd746a0ecfd6aeb785ecb93c593d5a680f",
+ "homepage": "https://github.com/sindresorhus/lazy-req#readme",
+ "keywords": [
+ "require",
+ "load",
+ "module",
+ "modules",
+ "lazy",
+ "lazily",
+ "defer",
+ "deferred",
+ "proxy",
+ "proxies"
+ ],
+ "license": "MIT",
+ "maintainers": [
+ {
+ "name": "sindresorhus",
+ "email": "sindresorhus@gmail.com"
+ }
+ ],
+ "name": "lazy-req",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/sindresorhus/lazy-req.git"
+ },
+ "scripts": {
+ "test": "xo && ava"
+ },
+ "version": "2.0.0"
+}
diff --git a/deps/npm/node_modules/update-notifier/node_modules/lazy-req/readme.md b/deps/npm/node_modules/update-notifier/node_modules/lazy-req/readme.md
new file mode 100644
index 0000000000..99599bc25c
--- /dev/null
+++ b/deps/npm/node_modules/update-notifier/node_modules/lazy-req/readme.md
@@ -0,0 +1,64 @@
+# lazy-req [![Build Status](https://travis-ci.org/sindresorhus/lazy-req.svg?branch=master)](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
+const lazyReq = require('lazy-req')(require);
+const _ = 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
+const 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
+const stuff = lazyReq('./math-lib')('sum', 'PHI');
+console.log(stuff.sum(1, 2)); // => 3
+console.log(stuff.PHI); // => 1.618033
+```
+
+### Proxy support in Node.js 6 or later
+
+If you use Node.js 6 or later, you can take advantage of ES2015 proxies and don't need to call it as a function.
+
+```js
+const lazyReq = require('lazy-req').proxy(require);
+const _ = lazyReq('lodash');
+
+// No need to call it as a function but still lazily required
+_.isNumber(2);
+```
+
+## Related
+
+- [resolve-from](https://github.com/sindresorhus/resolve-from) - Resolve the path of a module from a given path
+- [req-from](https://github.com/sindresorhus/req-from) - Require a module from a given path
+- [resolve-pkg](https://github.com/sindresorhus/resolve-pkg) - Resolve the path of a package regardless of it having an entry point
+- [lazy-value](https://github.com/sindresorhus/lazy-value) - Create a lazily evaluated value
+- [define-lazy-prop](https://github.com/sindresorhus/define-lazy-prop) - Define a lazily evaluated property on an object
+
+
+## License
+
+MIT © [Sindre Sorhus](https://sindresorhus.com)