Detailansicht verbessert
This commit is contained in:
		
							
								
								
									
										53
									
								
								express-server/node_modules/import-lazy/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								express-server/node_modules/import-lazy/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -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);
 | 
			
		||||
	};
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										21
									
								
								express-server/node_modules/import-lazy/license
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								express-server/node_modules/import-lazy/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
									
								
								express-server/node_modules/import-lazy/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										76
									
								
								express-server/node_modules/import-lazy/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,76 @@
 | 
			
		||||
{
 | 
			
		||||
  "_from": "import-lazy@^2.1.0",
 | 
			
		||||
  "_id": "import-lazy@2.1.0",
 | 
			
		||||
  "_inBundle": false,
 | 
			
		||||
  "_integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=",
 | 
			
		||||
  "_location": "/import-lazy",
 | 
			
		||||
  "_phantomChildren": {},
 | 
			
		||||
  "_requested": {
 | 
			
		||||
    "type": "range",
 | 
			
		||||
    "registry": true,
 | 
			
		||||
    "raw": "import-lazy@^2.1.0",
 | 
			
		||||
    "name": "import-lazy",
 | 
			
		||||
    "escapedName": "import-lazy",
 | 
			
		||||
    "rawSpec": "^2.1.0",
 | 
			
		||||
    "saveSpec": null,
 | 
			
		||||
    "fetchSpec": "^2.1.0"
 | 
			
		||||
  },
 | 
			
		||||
  "_requiredBy": [
 | 
			
		||||
    "/update-notifier"
 | 
			
		||||
  ],
 | 
			
		||||
  "_resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz",
 | 
			
		||||
  "_shasum": "05698e3d45c88e8d7e9d92cb0584e77f096f3e43",
 | 
			
		||||
  "_spec": "import-lazy@^2.1.0",
 | 
			
		||||
  "_where": "D:\\5CHITM\\Diplomarbeit\\SmartShopper\\SmartShopper\\express-server\\node_modules\\update-notifier",
 | 
			
		||||
  "author": {
 | 
			
		||||
    "name": "Sindre Sorhus",
 | 
			
		||||
    "email": "sindresorhus@gmail.com",
 | 
			
		||||
    "url": "sindresorhus.com"
 | 
			
		||||
  },
 | 
			
		||||
  "bugs": {
 | 
			
		||||
    "url": "https://github.com/sindresorhus/import-lazy/issues"
 | 
			
		||||
  },
 | 
			
		||||
  "bundleDependencies": false,
 | 
			
		||||
  "contributors": [
 | 
			
		||||
    {
 | 
			
		||||
      "name": "Jorge Bucaran",
 | 
			
		||||
      "email": "jbucaran@me.com"
 | 
			
		||||
    }
 | 
			
		||||
  ],
 | 
			
		||||
  "deprecated": false,
 | 
			
		||||
  "description": "Import modules lazily",
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "ava": "*",
 | 
			
		||||
    "xo": "*"
 | 
			
		||||
  },
 | 
			
		||||
  "engines": {
 | 
			
		||||
    "node": ">=4"
 | 
			
		||||
  },
 | 
			
		||||
  "files": [
 | 
			
		||||
    "index.js"
 | 
			
		||||
  ],
 | 
			
		||||
  "homepage": "https://github.com/sindresorhus/import-lazy#readme",
 | 
			
		||||
  "keywords": [
 | 
			
		||||
    "import",
 | 
			
		||||
    "require",
 | 
			
		||||
    "load",
 | 
			
		||||
    "module",
 | 
			
		||||
    "modules",
 | 
			
		||||
    "lazy",
 | 
			
		||||
    "lazily",
 | 
			
		||||
    "defer",
 | 
			
		||||
    "deferred",
 | 
			
		||||
    "proxy",
 | 
			
		||||
    "proxies"
 | 
			
		||||
  ],
 | 
			
		||||
  "license": "MIT",
 | 
			
		||||
  "name": "import-lazy",
 | 
			
		||||
  "repository": {
 | 
			
		||||
    "type": "git",
 | 
			
		||||
    "url": "git+https://github.com/sindresorhus/import-lazy.git"
 | 
			
		||||
  },
 | 
			
		||||
  "scripts": {
 | 
			
		||||
    "test": "xo && ava"
 | 
			
		||||
  },
 | 
			
		||||
  "version": "2.1.0"
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										64
									
								
								express-server/node_modules/import-lazy/readme.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								express-server/node_modules/import-lazy/readme.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,64 @@
 | 
			
		||||
# import-lazy [](https://travis-ci.org/sindresorhus/import-lazy)
 | 
			
		||||
 | 
			
		||||
> Import modules lazily
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Install
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
$ npm install --save import-lazy
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Usage
 | 
			
		||||
 | 
			
		||||
```js
 | 
			
		||||
// Pass in `require` or a custom import function
 | 
			
		||||
const importLazy = require('import-lazy')(require);
 | 
			
		||||
const _ = importLazy('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 = importLazy('lodash')('isNumber', 'isString');
 | 
			
		||||
 | 
			
		||||
// Useful when using destructuring assignment in ES2015
 | 
			
		||||
const {isNumber, isString} = importLazy('lodash')('isNumber', 'isString');
 | 
			
		||||
 | 
			
		||||
// Works out of the box for functions and regular properties
 | 
			
		||||
const stuff = importLazy('./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 importLazy = require('import-lazy').proxy(require);
 | 
			
		||||
const _ = importLazy('lodash');
 | 
			
		||||
 | 
			
		||||
// No need to call it as a function but still lazily imported
 | 
			
		||||
_.isNumber(2);
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Related
 | 
			
		||||
 | 
			
		||||
- [resolve-from](https://github.com/sindresorhus/resolve-from) - Resolve the path of a module from a given path
 | 
			
		||||
- [import-from](https://github.com/sindresorhus/import-from) - Import 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)
 | 
			
		||||
		Reference in New Issue
	
	Block a user