UNPKG

empty-php

Version:

Exact replica of the PHP empty function in for JavaScript and TypeScript

38 lines (37 loc) 1.43 kB
import type { EmptyArray, EmptyBoolean, EmptyNumber, EmptyObject, EmptyString, Undefined } from "./types"; /** * Returns true if the value is not PHP-empty. * This function is an alias for "!empty(value)". * @see empty */ export declare function notEmpty(value?: boolean | Undefined): value is Exclude<boolean, EmptyBoolean>; /** * Returns true if the value is not PHP-empty. * This function is an alias for "!empty(value)". * @see empty */ export declare function notEmpty(value?: string | Undefined): value is Exclude<string, EmptyString>; /** * Returns true if the value is not PHP-empty. * This function is an alias for "!empty(value)". * @see empty */ export declare function notEmpty(value?: number | Undefined): value is Exclude<number, EmptyNumber>; /** * Returns true if the value is not PHP-empty. * This function is an alias for "!empty(value)". * @see empty */ export declare function notEmpty(value?: unknown[] | Undefined): value is Exclude<unknown[], EmptyArray>; /** * Returns true if the value is not PHP-empty. * This function is an alias for "!empty(value)". * @see empty */ export declare function notEmpty<T extends object>(value?: T | Undefined): Exclude<T, Undefined>; /** * Returns true if the value is not PHP-empty. * This function is an alias for "!empty(value)". * @see empty */ export declare function notEmpty(value?: object | Undefined): value is Exclude<object, EmptyObject>;