@monstermann/fn
Version:
A utility library for TypeScript.
24 lines • 581 B
TypeScript
//#region src/function/isTruthy.d.ts
/**
* `isTruthy(target)`
*
* Checks if a value is truthy (not false, 0, "", null, or undefined).
*
* ```ts
* isTruthy("hello"); // true
* isTruthy(1); // true
* isTruthy(false); // false
* isTruthy(""); // false
* ```
*
* ```ts
* pipe("hello", isTruthy()); // true
* pipe(false, isTruthy()); // false
* ```
*/
declare const isTruthy: {
<T>(): (target: T) => target is Exclude<T, "" | 0 | false | null | undefined>;
<T>(target: T): target is Exclude<T, "" | 0 | false | null | undefined>;
};
//#endregion
export { isTruthy };