falsyPromiseOrThrow
Generates a .then() interceptor that avoids any truthy value by throwing an error.
Falsy values: false, 0, -0, 0n, "", null, undefined, and NaN.
Available since v1.1.0
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
error | string | The error message thrown if the data is truthy. |
Returns
Section titled “Returns”(data: T) => T | never — A .then() interceptor: returns data unchanged, or throws error.
