Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 13x 11x | /**
* A {@link Predicate} that always returns `true`.
*
* Opposite of {@link alwaysFalse}.
*
* @remark
* All arguments are ignored
*
* @example
* Returns always `true`
* ```ts
* const result = alwaysTrue();
* console.log(result); // true
* ```
*
* @example
* As default value for an optional Function argument
* ```ts
* function canParseBoolean(canParse: ((s: String) => boolean) = alwaysTrue) {
* return canParse("false");
* }
*
* const result = canParseBoolean();
* console.log(result); // true
* ```
*
* @returns `true`
*/
export const alwaysTrue = (..._: unknown[]): true => {
return true;
};
|