UNPKG

@future-widget-lab/safe-ops

Version:

A set of helper functions for performing operations safely, preventing runtime errors from disrupting your application.

8 lines (7 loc) 179 B
/** * @description * Use this helper to safeguard against falsey values. */ export const safeguard = <T>(x: T | false | undefined | null | '' | 0): x is T => { return !!x; };