main
Last change
on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
905 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | import { curryN } from 'ramda';
|
---|
| 2 |
|
---|
| 3 | /**
|
---|
| 4 | * In JavaScript, a `truthy` value is a value that is considered true
|
---|
| 5 | * when evaluated in a Boolean context. All values are truthy unless
|
---|
| 6 | * they are defined as falsy (i.e., except for `false`, `0`, `""`, `null`, `undefined`, and `NaN`).
|
---|
| 7 | *
|
---|
| 8 | * @func isTruthy
|
---|
| 9 | * @memberOf RA
|
---|
| 10 | * @since {@link https://char0n.github.io/ramda-adjunct/2.2.0|v2.2.0}
|
---|
| 11 | * @category Type
|
---|
| 12 | * @sig * -> Boolean
|
---|
| 13 | * @param {*} val The value to test
|
---|
| 14 | * @return {boolean}
|
---|
| 15 | * @see {@link https://developer.mozilla.org/en-US/docs/Glossary/Truthy|truthy}, {@link RA.isFalsy|isFalsy}
|
---|
| 16 | * @example
|
---|
| 17 | *
|
---|
| 18 | * RA.isTruthy({}); // => true
|
---|
| 19 | * RA.isTruthy([]); // => true
|
---|
| 20 | * RA.isTruthy(42); // => true
|
---|
| 21 | * RA.isTruthy(3.14); // => true
|
---|
| 22 | * RA.isTruthy('foo'); // => true
|
---|
| 23 | * RA.isTruthy(new Date()); // => true
|
---|
| 24 | * RA.isTruthy(Infinity); // => true
|
---|
| 25 | */
|
---|
| 26 | const isTruthy = curryN(1, Boolean);
|
---|
| 27 |
|
---|
| 28 | export default isTruthy;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.