Data Type Check helpers.
- Description:
Data Type Check helpers.
Methods
(static) isAnArray(userInput) → {boolean}
Check if the user input is an array.
- Description:
Check if the user input is an array.
Example
isAnArray([1, 2, 3]) => true
isAnArray([]) => true
isAnArray({}) => false
isAnArray(null) => false
isAnArray() => false
isAnArray(undefined) => false
isAnArray(42) => false
Parameters:
| Name | Type | Description |
|---|---|---|
userInput |
* | Any value to check |
Returns:
Returns true if array, false if not
- Type
- boolean
(static) isBigint(userInput) → {boolean}
Check if the user input is a Bigint or not.
- Description:
Check if the user input is a Bigint or not.
Example
isBigint(37n) => true
isBigint("hello") => false
isBigint(37) => false
isBigint() => false
isBigint(null) => false
Parameters:
| Name | Type | Description |
|---|---|---|
userInput |
* | Any value to check |
Returns:
Returns true if bigint, false if not
- Type
- boolean
(static) isBoolean(userInput) → {boolean}
Check if the user input is a boolean or not.
- Description:
Check if the user input is a boolean or not.
Example
isBoolean(37) => false
isBoolean("hello") => false
isBoolean(false) => true
isBoolean() => false
isBoolean(null) => false
Parameters:
| Name | Type | Description |
|---|---|---|
userInput |
* | Any value to check |
Returns:
Returns true if boolean, false if not
- Type
- boolean
(static) isFunction(userInput) → {boolean}
Check if the user input is a function.
- Description:
Check if the user input is a function.
Example
isFunction(function() {}) => true
isFunction(() => {}) => true
isFunction(42) => false
isFunction(null) => false
isFunction() => false
Parameters:
| Name | Type | Description |
|---|---|---|
userInput |
* | Any value to check |
Returns:
Returns true if function, false if not
- Type
- boolean
(static) isNumber(userInput) → {boolean}
Check if the user input is a number or not.
- Description:
Check if the user input is a number or not.
Example
isNumber(37) => true
isNumber("hello") => false
isNumber() => false
isNumber(null) => false
isNumber(undefined) => false
Parameters:
| Name | Type | Description |
|---|---|---|
userInput |
* | Any value to check |
Returns:
Returns true if number, false if not
- Type
- boolean
(static) isObject(userInput) → {boolean}
Check if the user input is an object.
- Description:
Check if the user input is an object.
Example
isObject({}) // true
isObject({ a: 1 }) // true
isObject([]) // false
isObject(null) // false
isObject(42) // false
Parameters:
| Name | Type | Description |
|---|---|---|
userInput |
* | Any value to check |
Returns:
Returns true if object, false if not
- Type
- boolean
(static) isString(userInput) → {boolean}
Check if the user input is a string or not.
- Description:
Check if the user input is a string or not.
Example
isString(37) // false
isString("hello") // true
isString() // false
isString(null) // false
isString(undefined) // false
Parameters:
| Name | Type | Description |
|---|---|---|
userInput |
* | Any value to check |
Returns:
Returns true if string, false if not
- Type
- boolean