isTruthy | WebHare Platform SDKWebHare Platform SDKPreparing search index...@webhare/stdisTruthyFunction isTruthyisTruthy<T>(a: T): a is T & {}Returns (and TypeScript-asserts) that the specified function is truthy. Handy for adjusting the type of an array when filtering out falsy values Type ParametersTParametersa: TReturns a is T & {}Exampleconst myarray: Array<number | null> = [0, null];const filtered: number[] = myarray.filter(isTruthy); Copy SettingsMember VisibilityProtectedInheritedThemeOSLightDarkWebHare Platform SDKLoading...
Returns (and TypeScript-asserts) that the specified function is truthy. Handy for adjusting the type of an array when filtering out falsy values