UNPKG

empty-php

Version:

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

44 lines (43 loc) 1.84 kB
import type { EmptyArray, EmptyBoolean, EmptyNumber, EmptyObject, EmptyString, Undefined } from "./types"; /** * Determines if a boolean is empty * @param value The value to determine if empty * @returns true if the value is empty, false otherwise * @see https://www.php.net/manual/en/function.empty.php */ export declare function empty(value?: boolean | Undefined): value is EmptyBoolean; /** * Determines if a string is empty * @param value The value to determine if empty * @returns true if the value is empty, false otherwise * @see https://www.php.net/manual/en/function.empty.php */ export declare function empty(value?: string | Undefined): value is EmptyString; /** * Determines if a number is empty * @param value The value to determine if empty * @returns true if the value is empty, false otherwise * @see https://www.php.net/manual/en/function.empty.php */ export declare function empty(value?: number | Undefined): value is EmptyNumber; /** * Determines if an array is empty * @param value The value to determine if empty * @returns true if the value is empty, false otherwise * @see https://www.php.net/manual/en/function.empty.php */ export declare function empty(value?: unknown[] | Undefined): value is EmptyArray; /** * Determines if a complex object is empty * @param value The value to determine if empty * @returns true if the value is empty, false otherwise * @see https://www.php.net/manual/en/function.empty.php */ export declare function empty<T extends object>(value?: T | Undefined): value is Undefined; /** * Determines if an object is empty * @param value The value to determine if empty * @returns true if the value is empty, false otherwise * @see https://www.php.net/manual/en/function.empty.php */ export declare function empty(value?: object | Undefined): value is EmptyObject;