hfs-utilities
Version:
Health Fund Solution's internal utilities library for Typescript projects
62 lines (61 loc) • 2.86 kB
TypeScript
import moment, { Moment } from 'moment-timezone';
/**
* @description - Checks if a value is null or undefined.
* @param {any} value - The value to check.
* @returns {boolean} - Returns true if the value is null or undefined.
*/
export declare const isNullOrUndefined: (value: any) => boolean;
/**
* @description - Checks if a value is not null and not undefined.
* @param {any} value - The value to check.
* @returns {boolean} - Returns true if the value is not null and not undefined.
*/
export declare const isNotNullAndNotUndefined: (value: any) => boolean;
/**
* @description - Checks if a value is null, undefined, an empty string, an empty array, an object without properties, or 0.
* @param value - The value to check.
* @returns - Returns true if the value is null, undefined, an empty string, an empty array, an object without properties, or 0.
*/
export declare const isEmpty: (value: any) => boolean;
/**
* @description - coerces a value to an array if it is not already an array.
* @param value - The value to coerce.
* @returns - Returns the value as an array or an empty array if null or undefined is passed.
*/
export declare const asArray: (value: any) => any[];
/**
* @description - Checks if a value is an empty string
* @param value - The value to check.
* @returns {boolean} - Returns true if the value is an empty string.
*/
export declare const isEmptyString: (value: any) => boolean;
/**
* @description - Checks if a value is a none empty string
* @param value - The value to check.
* @returns { boolean } - Returns true if the value is a none empty string.
*/
export declare const isNotEmptyString: (value: any) => boolean;
/**
* @description - Checks if a value is a string
* @param value - The value to check.
* @returns { boolean } - Returns true if the value is a string.
*/
export declare const isString: (value: any) => boolean;
/**
* @description - Checks if a value is a number
* @param value - The value to check.
* @returns { boolean } - Returns true if the value is a number.
*/
export declare const isNumber: (value: any) => boolean;
/**
* @description - Returns a float value or undefined if the value is not a number.
* @param number - The value to convert to a float.
* @returns { number | undefined } - Returns a float value or undefined if the value is not a number.
*/
export declare const getFloat: (number: string | undefined | number | null) => number | undefined;
/**
* @description - Returns a date object from a string or null if the value is not a valid date.
* @param date - The value to convert to a date.
* @returns { Date | null } - Returns a date object or null if the value is not a valid date.
*/
export declare const getDate: (date?: string | Date | Moment, hoursToAdd?: number) => moment.Moment | null;