falsyPromiseOrThrow
Returns a function that passes through falsy data or throws an error.
Available since v1.0.0
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
error | string | The error message to throw if data is truthy |
Returns
Section titled “Returns”function — A function that returns the data if falsy, or throws
Examples
Section titled “Examples”Pass through falsy values
Section titled “Pass through falsy values”Returns the value if falsy, throws otherwise.
Throw on truthy values
Section titled “Throw on truthy values”Throws an error when the value is truthy.
