import { isDefined } from 'ngwr/utils';
const items: (string | null | undefined)[] = ['a', null, 'b', undefined];
const present = items.filter(isDefined); // string[]isDefined
Type guard that drops null and undefined, for use with Array.filter.
Usage
API
| Name | Description | Type | Default |
|---|---|---|---|
isDefined(v) | Narrows out null and undefined. Pass it straight to Array.filter. | <T>(v: T | null | undefined) => v is T | — |