Test if a given value is truthy.
This method tests if a given value is truthy.
Kind: Exported member
Returns: boolean
- true
if the value is truthy: otherwise false
.
Param | Type | Description |
---|---|---|
value | * |
The value to test. |
Example
import isTruthy from 'is-truthy-x';
console.log(isTruthy()); // false
console.log(isTruthy(0)); // false
console.log(isTruthy('')); // false
console.log(isTruthy(false)); // false
console.log(isTruthy(null)); // false
console.log(isTruthy(true)); // true
console.log(isTruthy([])); // true
console.log(isTruthy(1)); // true
console.log(isTruthy(function() {})); // true