Initial commit
This commit is contained in:
21
node_modules/evaluate-value/LICENSE
generated
vendored
Normal file
21
node_modules/evaluate-value/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017 Steven Vachon
|
||||
|
||||
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.
|
41
node_modules/evaluate-value/README.md
generated
vendored
Normal file
41
node_modules/evaluate-value/README.md
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
# evaluate-value [![NPM Version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url]
|
||||
|
||||
> Return a value or an evaluated function (with arguments).
|
||||
|
||||
|
||||
* When the first input argument is a function, it is executed with the remaining arguments, and the result is returned.
|
||||
* When the first input argument is *not* a function, it is simply returned.
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
[Node.js](http://nodejs.org/) `>= 8` is required. To install, type this at the command line:
|
||||
```shell
|
||||
npm install evaluate-value
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const evaluateValue = require('evaluate-value');
|
||||
|
||||
evaluateValue(true);
|
||||
//-> true
|
||||
|
||||
evaluateValue(() => true);
|
||||
//-> true
|
||||
|
||||
evaluateValue(
|
||||
(arg1, arg2) => arg1 === arg2,
|
||||
true,
|
||||
false
|
||||
);
|
||||
//-> false
|
||||
```
|
||||
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/evaluate-value.svg
|
||||
[npm-url]: https://npmjs.com/package/evaluate-value
|
||||
[travis-image]: https://img.shields.io/travis/stevenvachon/evaluate-value.svg
|
||||
[travis-url]: https://travis-ci.org/stevenvachon/evaluate-value
|
17
node_modules/evaluate-value/index-es5.js
generated
vendored
Normal file
17
node_modules/evaluate-value/index-es5.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
var evaluateValue = function evaluateValue(value) {
|
||||
if (typeof value === "function") {
|
||||
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
args[_key - 1] = arguments[_key];
|
||||
}
|
||||
|
||||
return value.apply(void 0, args);
|
||||
}
|
||||
|
||||
return value;
|
||||
};
|
||||
|
||||
module.exports = evaluateValue;
|
||||
|
||||
//# sourceMappingURL=index-es5.js.map
|
1
node_modules/evaluate-value/index-es5.js.map
generated
vendored
Normal file
1
node_modules/evaluate-value/index-es5.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["index.js"],"names":[],"mappings":"AAAA;;AAIA,IAAM,aAAa,GAAG,SAAhB,aAAgB,CAAC,KAAD,EACtB;AACC,MAAI,OAAO,KAAP,KAAiB,UAArB,EACA;AAAA,sCAHgC,IAGhC;AAHgC,MAAA,IAGhC;AAAA;;AACC,WAAO,KAAK,MAAL,SAAS,IAAT,CAAP;AACA;;AAED,SAAO,KAAP;AACA,CARD;;AAYA,MAAM,CAAC,OAAP,GAAiB,aAAjB","file":"index-es5.js","sourcesContent":["\"use strict\";\n\n\n\nconst evaluateValue = (value, ...args) =>\n{\n\tif (typeof value === \"function\")\n\t{\n\t\treturn value(...args);\n\t}\n\n\treturn value;\n};\n\n\n\nmodule.exports = evaluateValue;\n"]}
|
17
node_modules/evaluate-value/index.js
generated
vendored
Normal file
17
node_modules/evaluate-value/index.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
|
||||
|
||||
const evaluateValue = (value, ...args) =>
|
||||
{
|
||||
if (typeof value === "function")
|
||||
{
|
||||
return value(...args);
|
||||
}
|
||||
|
||||
return value;
|
||||
};
|
||||
|
||||
|
||||
|
||||
module.exports = evaluateValue;
|
33
node_modules/evaluate-value/package.json
generated
vendored
Normal file
33
node_modules/evaluate-value/package.json
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "evaluate-value",
|
||||
"description": "Return a value or an evaluated function (with arguments).",
|
||||
"version": "2.0.0",
|
||||
"license": "MIT",
|
||||
"author": "Steven Vachon <contact@svachon.com> (https://svachon.com)",
|
||||
"browser": "index-es5.js",
|
||||
"repository": "github:stevenvachon/evaluate-value",
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.4.3",
|
||||
"@babel/core": "^7.4.3",
|
||||
"@babel/preset-env": "^7.4.3",
|
||||
"chai": "^4.2.0",
|
||||
"mocha": "^6.1.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
},
|
||||
"scripts": {
|
||||
"prepublishOnly": "npm test && babel index.js --out-file=index-es5.js --presets=@babel/env --source-maps",
|
||||
"test": "mocha test.js --check-leaks --bail"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index-es5.js",
|
||||
"index-es5.js.map"
|
||||
],
|
||||
"keywords": [
|
||||
"function",
|
||||
"options",
|
||||
"value"
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user