UNPKG

@alessiofrittoli/web-utils

Version:
100 lines (98 loc) 2.9 kB
/** * Check if string is not an empty string. * * @param string The string to check. * * @returns `true` if string is not empty, `false` otherwise. */ declare const isNotEmpty: (string: string) => boolean; /** * Check if string is an empty string. * * @param string The string to check. * * @returns `true` if string is empty, `false` otherwise. */ declare const isEmpty: (string: string) => boolean; /** * Check whether email is valid. * * @param email The email to check. * * @returns `true` if the email is valid, `false` otherwise. */ declare const isValidEmail: (email: string) => boolean; /** * Check whether phone number is valid. * * @param phone The phone number to check. * * @supported * * - (123) 456-7890 * - +(123) 456-7890 * - +(123)-456-7890 * - +(123) - 456-7890 * - +(123) - 456-78-90 * - 123-456-7890 * - 123.456.7890 * - 1234567890 * - +393204567890 * - +39 320 456 7890 * - 00393204567890 * - 075-63546725 * * @returns `true` if the phone number is valid, `false` otherwise. */ declare const isValidPhoneNumber: (phone: string) => boolean; /** * Check whether the given string is a valid VAT number. * @param s The string to test. * @returns `true` if the given string is a valid VAT number, `false` otherwise. */ declare const isValidVat: (s: string) => boolean; /** * Check if value is less then another value. * * @param a The number being compared. * @param value The value to compare. * * @returns `true` if given `value` is less than `a`, `false` otherwise. */ declare const isLessThan: (a: number, value?: number | string) => boolean; /** * Check if value is greater then another value. * * @param a The number being compared. * @param value The value to compare. * * @returns `true` if given `value` is greater than `a`, `false` otherwise. */ declare const isGreaterThan: (a: number, value?: number | string) => boolean; /** * Check if value is in a range of two values. * * @param a The minimum value. * @param b The maximum value. * @param value The value to compare. * * @returns `true` if given `value` is equal or greather than `a` and equal or less than `b`, `false` otherwise. */ declare const isInRange: (a: number, b: number, value?: number | string) => boolean; /** * Check whether value `a` is equal to `b`. * * @param a The first value to check. * @param b The second value to check. * * @returns `true` if `a` and `b` are equal, `false` otherwise. */ declare const isStrictEqual: (a: unknown, b: unknown) => boolean; /** * Detect if input contains SQL statements. * * @param value The value to check. * @returns `true` if value contains SQL statements, `false` otherwise. */ declare const isSQLStatement: (value: any) => boolean; export { isEmpty, isGreaterThan, isInRange, isLessThan, isNotEmpty, isSQLStatement, isStrictEqual, isValidEmail, isValidPhoneNumber, isValidVat };