UNPKG

@wordpress/components

Version:
42 lines 1.66 kB
/** * Determines if a value is null or undefined. * * @template T * * @param {T} value The value to check. * @return {value is Exclude<T, null | undefined>} Whether value is not null or undefined. */ export function isValueDefined<T>(value: T): value is Exclude<T, null | undefined>; /** * Determines if a value is empty, null, or undefined. * * @param {string | number | null | undefined} value The value to check. * @return {value is ("" | null | undefined)} Whether value is empty. */ export function isValueEmpty(value: string | number | null | undefined): value is "" | null | undefined; /** * Get the first defined/non-null value from an array. * * @template T * * @param {Array<T | null | undefined>} values Values to derive from. * @param {T} fallbackValue Fallback value if there are no defined values. * @return {T} A defined value or the fallback value. */ export function getDefinedValue<T>(values: (T | null | undefined)[] | undefined, fallbackValue: T): T; /** * Checks to see if a value is a numeric value (`number` or `string`). * * Intentionally ignores whether the thousands delimiters are only * in the thousands marks. * * @param {any} value * @param {string} [locale] * @return {boolean} Whether value is numeric. */ export function isValueNumeric(value: any, locale?: string | undefined): boolean; export function stringToNumber(value: string): number; export function numberToString(value: number): string; export function ensureNumber(value: string | number): number; export function ensureString(value: string | number): string; //# sourceMappingURL=values.d.ts.map