Function isType

  • check if value is of a specific type, nulls, NaN and arrays are specially handled

    Parameters

    Returns void

    isType('foo', 'string');
    
    isType(1, 'number');
    
    isType(1n, 'bigint');
    
    isType(true, 'boolean');
    
    isType(Symbol('foo'), 'symbol');
    
    isType(undefined, 'undefined');
    
    isType({}, 'object');
    
    isType(() => {}, 'function');
    
    isType(null, 'null');
    
    isType(NaN, 'NaN');
    
    isType([], 'array');
    
  • check if value is of a specific type, nulls, NaN and arrays are specially handled

    Parameters

    • value: string
    • expectedType: "string"

    Returns void

    isType('foo', 'string');
    
  • check if value is of a specific type, nulls, NaN and arrays are specially handled

    Parameters

    • value: number
    • expectedType: "number" | "NaN"

    Returns void

    isType(1, 'number');
    
    isType(NaN, 'NaN');
    
  • check if value is of a specific type, nulls, NaN and arrays are specially handled

    Parameters

    • value: bigint
    • expectedType: "bigint"

    Returns void

    isType(1n, 'bigint');
    
  • check if value is of a specific type, nulls, NaN and arrays are specially handled

    Parameters

    • value: boolean
    • expectedType: "boolean"

    Returns void

    isType(true, 'boolean');
    
  • check if value is of a specific type, nulls, NaN and arrays are specially handled

    Parameters

    • value: symbol
    • expectedType: "symbol"

    Returns void

    isType(Symbol('foo'), 'symbol');
    
  • check if value is of a specific type, nulls, NaN and arrays are specially handled

    Parameters

    • value: undefined
    • expectedType: "undefined"

    Returns void

    isType(Symbol('foo'), 'symbol');
    
  • check if value is of a specific type, nulls, NaN and arrays are specially handled

    Parameters

    • value: object
    • expectedType: "object"

    Returns void

    isType({}, 'object');
    
  • check if value is of a specific type, nulls, NaN and arrays are specially handled

    Parameters

    • value: Function
    • expectedType: "function"

    Returns void

    isType(() => {}, 'function');
    
  • check if value is of a specific type, nulls, NaN and arrays are specially handled

    Parameters

    • value: null
    • expectedType: "null"

    Returns void

    isType(null, 'null');
    
  • check if value is of a specific type, nulls, NaN and arrays are specially handled

    Parameters

    • value: any[]
    • expectedType: "array"

    Returns void

    isType([], 'array');