fallback
Asserts a value is not null or undefined
Import
import { fallback } from '@fullstacksjs/toolbox';
Signature
function assertNotNull<T>(value: Nullable<T>, error: string = 'Value is required'): asserts value is NonNullable<T> {}
Examples
assertNotNull(null, 'WTF') // Throw 'WTF'
assertNotNull(undefined, 'WTF') // Throw 'WTF'
assertNotNull(true) // noop