module
types
Source: types/
Methods
inner
getFuncName([defaultValue]) → String
Returns the name of the function in which is called.
Example
const hello = () => getFuncName()
hello() // -> "hello"
getFuncName() // -> "Unknown"
getFuncName("ups") // -> "ups"
Parameter
Name | Type | Optional | Description |
---|---|---|---|
defaultValue |
String |
Yes |
string for unknown calls. Defaults to |
- See also
- Returns
-
String
indicating the possible name of the function
inner
isNil(num) → boolean
Checks if the passed type is a non defined value, either undefined
or null
Example
isNil(null) // -> true
isNil(3) // -> false
isNil() // -> true
isNil(undefined) // -> true
Parameter
Name | Type | Optional | Description |
---|---|---|---|
num |
any type |
|
any possible data type |
- See also
- Returns
-
boolean
indicating if it's an non defined
inner
isNumber(num, flag) → boolean
Checks correctly if the passed type is or not a number
Examples
isNumber(null) // -> false note isNaN(null) will return false instead
isNumber("33", true) // -> false since the strict flag is set and "33" is not a strict number
Parameters
Name | Type | Optional | Description |
---|---|---|---|
num |
any type |
|
any possible data type |
flag |
|
|
if you want strict numbers or not |
- See also
- Returns
-
boolean
indicating if is a number or not (the flag argument can be used to further filter strict numbers)
inner
isObject(num) → boolean
Checks correctly if the passed type is or not an object
Example
isObject(null) // -> false note that typeof will return true
isObject({}) // -> true
isObject(new Error()) // -> true
Parameter
Name | Type | Optional | Description |
---|---|---|---|
num |
any type |
|
any possible data type |
- See also
- Returns
-
boolean
indicating if it's an object or not