Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stevenvachon/evaluate-value
Return a value or an evaluated function (with arguments).
https://github.com/stevenvachon/evaluate-value
config configuration nodejs options
Last synced: 14 days ago
JSON representation
Return a value or an evaluated function (with arguments).
- Host: GitHub
- URL: https://github.com/stevenvachon/evaluate-value
- Owner: stevenvachon
- License: mit
- Created: 2017-02-23T00:54:21.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-04-22T16:41:49.000Z (almost 6 years ago)
- Last Synced: 2024-10-06T04:23:47.289Z (5 months ago)
- Topics: config, configuration, nodejs, options
- Language: JavaScript
- Size: 4.88 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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);
//-> trueevaluateValue(() => true);
//-> trueevaluateValue(
(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