UNPKG

@barchart/common-js

Version:
171 lines (170 loc) 3.56 kB
/** * Utilities for interrogating variables (e.g. checking data types). * * @public * @module lang/is */ /** * Returns true if the argument is a number. NaN will return false. * * @static * @public * @param {*} candidate * @returns {boolean} */ export function number(candidate: any): boolean; /** * Returns true if the argument is NaN. * * @static * @public * @param {*} candidate * @returns {boolean} */ export function nan(candidate: any): boolean; /** * Returns true if the argument is a valid 32-bit integer. * * @static * @public * @param {*} candidate * @returns {boolean} */ export function integer(candidate: any): boolean; /** * Returns true if the argument is a valid integer (which can exceed 32 bits); however, * the check can fail above the value of Number.MAX_SAFE_INTEGER. * * @static * @public * @param {*} candidate * @returns {boolean} */ export function large(candidate: any): boolean; /** * Returns true if the argument is a positive number. * * @static * @public * @param {*} candidate * @returns {boolean} */ export function positive(candidate: any): boolean; /** * Returns true if the argument is a negative number. * * @static * @public * @param {*} candidate * @returns {boolean} */ export function negative(candidate: any): boolean; /** * Returns true if the argument is iterable. * * @static * @public * @param {*} candidate * @returns {boolean} */ export function iterable(candidate: any): boolean; /** * Returns true if the argument is a string. * * @static * @public * @param {*} candidate * @returns {boolean} */ export function string(candidate: any): boolean; /** * Returns true if the argument is a JavaScript Date instance. * * @static * @public * @param {*} candidate * @returns {boolean} */ export function date(candidate: any): boolean; /** * Returns true if the argument is a JavaScript RegExp instance. * * @static * @public * @param {*} candidate * @returns {boolean} */ export function regexp(candidate: any): boolean; /** * Returns true if the argument is a function. * * @static * @public * @param {*} candidate * @returns {boolean} */ export function fn(candidate: any): boolean; /** * Returns true if the argument is an array. * * @static * @public * @param {*} candidate * @returns {boolean} */ export function array(candidate: any): boolean; /** * Returns true if the argument is a boolean value. * * @static * @public * @param {*} candidate * @returns {boolean} */ export function boolean(candidate: any): boolean; /** * Returns true if the argument is a non-null object. * * @static * @public * @param {*} candidate * @returns {boolean} */ export function object(candidate: any): boolean; /** * Returns true if the argument is null. * * @static * @public * @param {*} candidate * @returns {boolean} */ export function nil(candidate: any): boolean; /** * Returns true if the argument is undefined. * * @static * @public * @param {*} candidate * @returns {boolean} */ export function undef(candidate: any): boolean; /** * Returns true if the argument is a zero-length string. * * @static * @public * @param {*} candidate * @returns {boolean} */ export function zeroLengthString(candidate: any): boolean; /** * Given two classes, determines if the "child" class extends * the "parent" class (without instantiation). * * @public * @param {Function} parent * @param {Function} child * @returns {boolean} */ export function extension(parent: Function, child: Function): boolean;