logical-or

Binary logical OR operator (||) as an auto-curried function.

Usage no npm install needed!

<script type="module">
  import logicalOr from 'https://cdn.skypack.dev/logical-or';
</script>

README

logical-or

Binary logical OR operator (||) as an auto-curried function.

Build Status Code Climate js-standard-style

npm install logical-or --save

You can also use Duo, Bower or download the files manually.

npm stats

npm NPM downloads David

Overview

Returns expr1 if it can be converted to true; otherwise, returns expr2. Thus, when used with Boolean values, || returns true if either operand is true; if both are false, returns false.

API Example

Pointful
var or = require('logical-or')
or(1, 0)
//=> 1
Pointfree Style
var or = require('logical-or')
var prices = ['$ 50.00', '', '$ 20.00']

prices.map(or('Price unknown'))
//=> ['$ 50.00', 'Price unknown', '$ 20.00']

API

or(expr2, expr1)

please note the argument order.

arguments
  • expr2 (mixed).
  • expr1 (mixed).
returns
  • (mixed) Returns expr1 if it can be converted to true; otherwise, returns expr2.

Related

Contributing

SEE: contributing.md

Licenses

GitHub license