Language Utilities
Mostly type or instance checking.
#
getObjectTypegetObjectType(value) => string
Gets value's type from Object.prototype.toString
method. For example, an async function will return AsyncFunction
.
#
hasOwnPropshasOwnProps(value) => boolean
Returns true
if the value
is an object having own properties, false
otherwise.
#
isArrayBufferisArrayBuffer(value) => boolean
Returns true
if the value
is an ArrayBuffer
, false
otherwise.
#
isBooleanisBoolean(value) => boolean
Returns true
if the value
is of the boolean type, false
otherwise.
#
isCoroutineisCoroutine(value) => boolean
Returns true
if the value
looks like Coroutine
, false
otherwise. The only mandatory method is next
.
#
isDateisDate(value) => boolean
Returns true
if the value
is a Date
object, false
otherwise.
#
isDefinedisDefined(value) => boolean
Returns true
if the value
is exactly not undefined
, false
otherwise.
#
isErrorisError(value) => boolean
Returns true
if the value
is an Error
, false
otherwise.
#
isFalsyisFalsy(value) => boolean
Returns true
if the value
converted to Boolean is false
, false
otherwise.
#
isFunctionisFunction(value) => boolean
Returns true
if the value
is a function, false
otherwise.
#
isIterableisIterable(value) => boolean
Returns true
if the value
is an object having Symbol.iterator
method, false
otherwise.
#
isIteratorisIterator(value) => boolean
Returns true
if the value
is an object having next
method, false
otherwise.
#
isMapisMap(value) => boolean
Returns true
if the value
is an Map
, false
otherwise.
#
isNegativeisNegative(value) => boolean
Returns true
if the value
is a Number less than zero, false
otherwise.
#
isNegativeOrZeroisNegativeOrZero(value) => boolean
Returns true
if the value
is a Number less or equal to zero, false
otherwise.
#
isNullisNull(value) => boolean
Returns true
if the value
is exactly null
, false
otherwise.
#
isNullishisNullish(value) => boolean
Returns true
if the value
is exactly null
or undefined
, false
otherwise.
#
isNumberisNumber(value) => boolean
Returns true
if the value
is of the Number type, false
otherwise. NaN
is a Number in JavaScript.
#
isNumberValueisNumberValue(value) => boolean
same as isNumber
, but Returns false
for NaN
.
#
isObjectisObject(value) => boolean
Returns true
if the value
is an Object, false
otherwise. null
is an Object is JavaScript.
#
isObjectValueisObjectValue(value) => boolean
same as isObject
, but Returns false
for null
.
#
isObserverisObserver(value) => boolean
Returns true
if the value
is an object with the next
method, false
otherwise.
#
isPlainObjectisPlainObject(value) => boolean
Returns true
if the value
is an object having no prototype or an Object.prototype, false
otherwise.
#
isPositiveisPositive(value) => boolean
Returns true
if the value
is a Number greater that zero, false
otherwise.
#
isPositiveOrZeroisPositiveOrZero(value) => boolean
Returns true
if the value
is a Number equal or greater than zero, false
otherwise.
#
isPromiseisPromise(value) => boolean
Returns true
if the value
is a Promise instance, false
otherwise.
#
isRegExpisRegExp(value) => boolean
Returns true
if the value
is a RegExp
, false
otherwise.
#
isSetisSet(value) => boolean
Returns true
if the value
is a Set
, false
otherwise.
#
isStringisString(value) => boolean
Returns true
if the value
is of the String type, false
otherwise.
#
isSymbolisSymbol(value) => boolean
Returns true
if the value
is of the Symbol type, false
otherwise.
#
isTruthyisTruthy(value) => boolean
Returns true
if the value
converted to Boolean is true
, false
otherwise.
#
isUndefinedisUndefined(value) => boolean
Returns true
if the value
is exactly undefined
, false
otherwise.
#
isWeakMapisWeakMap(value) => boolean
Returns true
if the value
is a WeakMap
, false
otherwise.
#
isWeakSetisWeakSet(value) => boolean
Returns true
if the value
is a WeakSet
, false
otherwise.