Methods
(static) isArguments(any) → {boolean}
- Source:
- Since:
- 0.5.0
Return true if the input is an arguments list
Example
> isArray([])
false
> isArray([1, 2])
false
> isArray({a: 1})
false
> isArray('foo')
false
> function returnArgs () {
return arguments;
}
> isArray(returnArgs())
true
Parameters:
Name | Type | Description |
---|---|---|
any |
* |
Returns:
- Type
- boolean
(static) isArray(any) → {boolean}
- Source:
- Since:
- 0.1.0
Return true if the input is an array
Example
> isArray([])
true
> isArray([1, 2])
true
> isArray({a: 1})
false
> isArray('foo')
false
> function returnArgs () {
return arguments;
}
> isArray(returnArgs())
false
Parameters:
Name | Type | Description |
---|---|---|
any |
* |
Returns:
- Type
- boolean
(static) isFunction(any) → {boolean}
- Source:
- Since:
- 0.12.0
Return true if the input is a function
Example
> isFunction(() => 2)
true
> makeFunc = n => x => x + n;
> isFunction(makeFunc(3))
true
> isFunction(1)
false
> isFunction(NaN)
false
> isFunction(Infinity)
false
> isFunction([1, 2])
false
> isFunction({a: 1})
false
> isFunction('foo')
false
> function returnArgs () {return arguments}
> isFunction(returnArgs())
false
Parameters:
Name | Type | Description |
---|---|---|
any |
* |
Returns:
- Type
- boolean
(static) isNotNaN(any) → {boolean}
- Source:
- Since:
- 0.1.0
Return true if the input is not a NaN. Remember that isNaN coerces the input with Number() to the output can be a bit surprising.
Example
> isNotNaN(1)
true
> isNotNaN(Infinity)
true
> isNotNaN([123])
true
> isNotNaN('123')
true
> isNotNaN(true)
true
> isNotNaN(false)
true
> isNotNaN(null)
true
> isNotNaN([1, 2])
false
> isNotNaN({a: 1})
false
> isNotNaN('123px')
false
> isNotNaN('foo')
false
> isNotNaN(undefined)
false
> isNotNaN(NaN)
false
> function returnArgs () {
return arguments;
}
> isNotNaN(returnArgs())
false
Parameters:
Name | Type | Description |
---|---|---|
any |
* |
Returns:
- Type
- boolean
(static) isNotNil(any) → {boolean}
- Source:
- Since:
- 0.2.0
Return true if the input is not undefined or null.
Example
> isNotNil(1)
true
> isNotNil(Infinity)
true
> isNotNil('123')
true
> isNotNil('123px')
true
> isNotNil([1, 2])
true
> isNotNil({a: 1})
true
> isNotNil(true)
true
> isNotNil(false)
true
> isNotNil(NaN)
true
> isNotNil(undefined)
false
> isNotNil(null)
false
> function returnArgs () {
return arguments;
}
> isNotNil(returnArgs())
false
Parameters:
Name | Type | Description |
---|---|---|
any |
* |
Returns:
- Type
- boolean
(static) isNotNull(any) → {boolean}
- Source:
- Since:
- 0.4.0
Return true if the input is not null.
Example
> isNotNull(1)
true
> isNotNull(Infinity)
true
> isNotNull('123')
true
> isNotNull('123px')
true
> isNotNull([1, 2])
true
> isNotNull({a: 1})
true
> isNotNull(true)
true
> isNotNull(false)
true
> isNotNull(NaN)
true
> isNotNull(undefined)
true
> isNotNull(null)
false
> function returnArgs () {
return arguments;
}
> isNotNull(returnArgs())
true
Parameters:
Name | Type | Description |
---|---|---|
any |
* |
Returns:
- Type
- boolean
(static) isNumber(any) → {boolean}
- Source:
- Since:
- 0.1.0
Return true if the input is a number
Example
> isNumber(1)
true
> isNumber(NaN)
true
> isNumber(Infinity)
true
> isNumber({a: 1})
false
> isNumber('foo')
false
> function returnArgs () {
return arguments;
}
> isNumber(returnArgs())
false
Parameters:
Name | Type | Description |
---|---|---|
any |
* |
Returns:
- Type
- boolean
(static) isObject(any) → {boolean}
- Source:
- Since:
- 0.1.0
- See:
Return true if the input is an object
Example
> isObject({a: 1})
true
> isObject([])
false
> isObject(1)
false
> isObject(NaN)
false
> isObject(Infinity)
false
> isObject('foo')
false
> function returnArgs () {
return arguments;
}
> isObject(returnArgs())
false
Parameters:
Name | Type | Description |
---|---|---|
any |
* |
Returns:
- Type
- boolean
(static) isPromise(any) → {boolean}
- Source:
- Since:
- 0.15.0
Return true if the input is a promise
Example
> isPromise(aFuncReturningAPromise())
true
> isPromise({a: 1})
false
Parameters:
Name | Type | Description |
---|---|---|
any |
* |
Returns:
- Type
- boolean
(static) isString(any) → {boolean}
- Source:
- Since:
- 0.1.0
Return true if the input is a string
Example
> isString('')
true
> isString('foo')
true
> isString(NaN)
false
> isString(Infinity)
false
> isString(1)
false
> isString([1, 2])
false
> isString({a: 1})
false
> function returnArgs () {
return arguments;
}
> isString(returnArgs())
false
Parameters:
Name | Type | Description |
---|---|---|
any |
* |
Returns:
- Type
- boolean
(static) isValidNumber(any) → {boolean}
- Source:
- Since:
- 0.1.0
- See:
Return true if the input is a valid number (including not being NaN)
Example
> [
1,
1.2,
Infinity,
].forEach(x => {
isValidNumber(x)
});
[true, ...]
> [
[],
[123],
[1, 2],
{a: 1},
'',
'123',
'123px',
'foo',
true,
null,
undefined,
NaN,
returnArgs()
].forEach(x => {
isValidNumber(x)
});
[false, ...]
Parameters:
Name | Type | Description |
---|---|---|
any |
* |
Returns:
- Type
- boolean
(static) negate(any) → {boolean}
- Source:
- Since:
- 0.10.0
Return the negated input.
Example
> negate(true)
false
> negate(false)
true
> negate(1)
false
> negate(0)
true
> negate('a')
false
> negate('')
true
> negate(null)
true
> negate(NaN)
true
> negate(undefined)
true
> negate([])
false
> negate({})
false
Parameters:
Name | Type | Description |
---|---|---|
any |
* |
Returns:
- Type
- boolean
(static) toFloatIsValidNumber(any) → {boolean}
- Source:
- Since:
- 0.1.0
Return true if the input, parsed to float, is a valid number
Example
> [
[1],
[1, 2],
[1, 2, 3],
'123',
'123px',
].forEach(x => {
toFloatIsValidNumber(x)
});
[true, ...]
> [
[],
'',
'foo',
{a: 1},
true,
null,
undefined,
returnArgs(),
returnArgs(1),
returnArgs(1, 2),
returnArgs(1, 2, 3)
].forEach(x => {
toFloatIsValidNumber(x)
});
[false, ...]
Parameters:
Name | Type | Description |
---|---|---|
any |
* |
Returns:
- Type
- boolean
(static) toNumberisValidNumber(any) → {boolean}
- Source:
- Since:
- 0.1.0
Return true if the input, converted to Number, is indeed a number
Example
> [
[],
[2],
'',
'123',
null,
true,
].forEach(x => {
toNumberisValidNumber(x)
});
[true, ...]
> [
{a: 1},
[1, 2],
'123px',
'foo',
undefined,
returnArgs(),
returnArgs(1),
returnArgs(1, 2),
returnArgs(1, 2, 3)
].forEach(x => {
toNumberisValidNumber(x)
});
[false, ...]
Parameters:
Name | Type | Description |
---|---|---|
any |
* |
Returns:
- Type
- boolean