Source

utils/hasValue.js

/**
 * Utility function to check if a value has meaningful content
 * @category Utils
 * @param {string | number | boolean | object | undefined | null} value - The value to check
 * @returns {boolean} - true if the value is not null, undefined, or empty string
 */
/**
 * Type-safe version of hasValue for strings
 * @category Utils
 * @param {string | undefined | null} value - The value to check
 * @returns {boolean} - true if the value is not null, undefined, or empty string
 */
export function hasStringValue(value) {
    return value != null && value !== "";
}
/**
 * Type-safe version of hasValue for numbers
 * @category Utils
 * @param {number | undefined | null} value - The value to check
 * @returns {boolean} - true if the value is not null
 */
export function hasNumberValue(value) {
    return value != null;
}
/**
 * Type-safe version of hasValue for arrays
 * @category Utils
 * @param {Array<unknown> | undefined | null} value - The value to check
 * @returns {boolean} - true if the value is not null and is an array
 */
export function hasArrayValue(value) {
    return Array.isArray(value) && value.length > 0;
}