A collection of the best JavaScript type testing methods.
npm install is-xA collection of the best JavaScript type testing methods.
es5-shim.js monkey-patches a JavaScript context to contain all EcmaScript 5es5-sham.js monkey-patches other ES5 methods as closely as possible.
For these methods, as closely as possible to ES5 is not very close.
Many of these shams are intended only to allow code to be written to ES5
without causing run-time errors in older engines. In many cases,
this means that these shams cause many ES5 methods to silently fail.
Decide carefully whether this is what you want. Note: es5-sham.js requires
es5-shim.js to be able to work properly.
json3.js monkey-patches the EcmaScript 5 JSON implimentation faithfully.
es6.shim.js provides compatibility shims so that legacy JavaScript engines
behave as closely as possible to ECMAScript 6 (Harmony).
See: https://github.com/Xotic750/is-x
Version: 1.0.12
Author: Xotic750
License: MIT
Copyright: Xotic750
* is-x
* ~isElement ⇒ boolean
* ~isSurrogatePair ⇒ boolean
* ~isNil(value) ⇒ boolean
* ~isNull(value) ⇒ boolean
* ~isUndefined(value) ⇒ boolean
* ~isEqual(value1, value2) ⇒ boolean
* ~isStrictEqual(value1, value2) ⇒ boolean
* ~isGt(value1, value2) ⇒ boolean
* ~isGte(value1, value2) ⇒ boolean
* ~isLt(value1, value2) ⇒ boolean
* ~isLte(value1, value2) ⇒ boolean
* ~isArguments(value) ⇒ boolean
* ~isString(value) ⇒ boolean
* ~isBoolean(value) ⇒ boolean
* ~isNumber(value) ⇒ boolean
* ~isDate(value) ⇒ boolean
* ~isNaN(value) ⇒ boolean
* ~isFinite(value) ⇒ boolean
* ~isSymbol(value) ⇒ boolean
* ~isTypedArray(value) ⇒ boolean
* ~isPrimitive(value) ⇒ boolean
* ~isPlainObject() ⇒ boolean
* ~isCallable(value) ⇒ boolean
* ~isConstructor(value) ⇒ boolean
* ~isFunction(value) ⇒ boolean
* ~isRegExp(value) ⇒ boolean
* ~isObject(value) ⇒ boolean
* ~isObjectLike(value) ⇒ boolean
* ~isStringTag(value, stringTag) ⇒ boolean
* ~isArray(value) ⇒ boolean
* ~isArrayLike(value) ⇒ boolean
* ~isProtoOf(prototypeObj, object) ⇒ boolean
* ~isFrozen(value) ⇒ boolean
* ~isSealed(value) ⇒ boolean
* ~is(value1, value2) ⇒ boolean
* ~isSameValueZero(value1, value2) ⇒ boolean
* ~isNegativeZero(value) ⇒ boolean
* ~isExtensible(value) ⇒ boolean
* ~isInteger(value) ⇒ boolean
* ~isSafeInteger(value) ⇒ boolean
* ~isPropertyKey(value) ⇒ boolean
* ~isLength(value) ⇒ boolean
* ~isNative(value) ⇒ boolean
* ~isDeepEqual(value1, value2) ⇒ boolean
* ~isStrictDeepEqual(value1, value2) ⇒ boolean
* ~isTypeOf(value, typeOfString) ⇒ boolean
* ~isBuffer(object) ⇒ boolean
* ~isArrayBuffer(object) ⇒ boolean
* ~isDataView(object) ⇒ boolean
* ~isOwnPropertyOf(object, property) ⇒ boolean
* ~isPropertyOf(object, property) ⇒ boolean
* ~isArrowFunction(object) ⇒ boolean
* ~isError(value) ⇒ boolean
* ~isMap(value) ⇒ boolean
* ~isSet(value) ⇒ boolean
* ~isFunctionName(fn, name) ⇒ boolean
* ~isAnonymous(fn) ⇒ boolean
* ~isArity(fn, arity) ⇒ boolean
* ~isGenerator(fn) ⇒ boolean
value is likely a DOM element.Kind: inner property of is-x
Returns: boolean - Returns true if value is a DOM element,
else false.
| Param | Type | Description |
| --- | --- | --- |
| value | \* | The value to check. |
Kind: inner property of is-x
Returns: boolean - Returns true if the two characters create a valid
UTF-16 surrogate pair; otherwise false.
| Param | Type | Description |
| --- | --- | --- |
| char1 | \* | The first character of a suspected surrogate pair. |
| char2 | \* | The second character of a suspected surrogate pair. |
value is null or undefined.Kind: inner method of is-x
Returns: boolean - Returns true if value is nullish, else false.
| Param | Type | Description |
| --- | --- | --- |
| value | \* | The value to check. |
value is null.Kind: inner method of is-x
Returns: boolean - Returns true if value is null, else false.
| Param | Type | Description |
| --- | --- | --- |
| value | \* | The value to check. |
value is undefined.Kind: inner method of is-x
Returns: boolean - Returns true if value is undefined, else false.
| Param | Type | Description |
| --- | --- | --- |
| value | \* | The value to check. |
value1 is value2 using == equality.Kind: inner method of is-x
Returns: boolean - Returns true if value1 == value2, else false.
| Param | Type | Description |
| --- | --- | --- |
| value1 | \* | The first value to check. |
| value2 | \* | The second value to check. |
value1 is value2 using === equality.Kind: inner method of is-x
Returns: boolean - Returns true if value1 === value2, else false.
| Param | Type | Description |
| --- | --- | --- |
| value1 | \* | The first value to check. |
| value2 | \* | The second value to check. |
value1 is greater than value2.Kind: inner method of is-x
Returns: boolean - Returns true if value1 > value2, else false.
| Param | Type | Description |
| --- | --- | --- |
| value1 | \* | The first value to check. |
| value2 | \* | The second value to check. |
value1 is greater than or equal to value2.Kind: inner method of is-x
Returns: boolean - Returns true if value1 >= value2, else false.
| Param | Type | Description |
| --- | --- | --- |
| value1 | \* | The first value to check. |
| value2 | \* | The second value to check. |
value1 is less than value2.Kind: inner method of is-x
Returns: boolean - Returns true if value1 < value2, else false.
| Param | Type | Description |
| --- | --- | --- |
| value1 | \* | The first value to check. |
| value2 | \* | The second value to check. |
value1 is less than or equal to value2.Kind: inner method of is-x
Returns: boolean - Returns true if value1 <= value2, else false.
| Param | Type | Description |
| --- | --- | --- |
| value1 | \* | The first value to check. |
| value2 | \* | The second value to check. |
value is likely an arguments object.Kind: inner method of is-x
Returns: boolean - Returns true if value is correctly classified,
else false.
| Param | Type | Description |
| --- | --- | --- |
| value | \* | The value to check. |
value is classified as a String primitive or object.Kind: inner method of is-x
Returns: boolean - Returns true if value is correctly classified,
else false.
| Param | Type | Description |
| --- | --- | --- |
| value | \* | The value to check. |
value is classified as a boolean primitive or object.Kind: inner method of is-x
Returns: boolean - Returns true if value is a boolean, else false.
| Param | Type | Description |
| --- | --- | --- |
| value | \* | The value to check. |
value is classified as a Number primitive or object.Kind: inner method of is-x
Returns: boolean - Returns true if value is correctly classified,
else false.
| Param | Type | Description |
| --- | --- | --- |
| value | \* | The value to check. |
value is classified as a Date object.Kind: inner method of is-x
Returns: boolean - Returns true if value is a Date object,
else false.
| Param | Type | Description |
| --- | --- | --- |
| value | \* | The value to check. |
value is NaN.Kind: inner method of is-x
Returns: boolean - Returns true if value is NaN, else false.
| Param | Type | Description |
| --- | --- | --- |
| value | \* | The value to check. |
value is a finite primitive number.Kind: inner method of is-x
Returns: boolean - Returns true if value is a finite number,
else false.
| Param | Type | Description |
| --- | --- | --- |
| value | \* | The value to check. |
value is classified as a Symbol primitive or object.Kind: inner method of is-x
Returns: boolean - Returns true if value is correctly classified,
else false.
| Param | Type | Description |
| --- | --- | --- |
| value | \* | The value to check. |
value is classified as a typed array.Kind: inner method of is-x
Returns: boolean - Returns true if value is correctly classified,
else false.
| Param | Type | Description |
| --- | --- | --- |
| value | \* | The value to check. |
value is a primitive.Kind: inner method of is-x
Returns: boolean - Returns true if value is a primitive,
else false.
| Param | Type | Description |
| --- | --- | --- |
| value | \* | The value to check. |
value is a plain object, that is, an object created by theObject constructor or one with a [[Prototype]] of null.Kind: inner method of is-x
Returns: boolean - Returns true if value is a plain object,
else false.
value is a 'Function.Kind: inner method of is-x
Returns: boolean - Returns
true if value is a Function,
else false. | Param | Type | Description |
| --- | --- | --- |
| value | \* | The value to check. |
$3
Checks if value is a 'constructor.Kind: inner method of is-x
Returns: boolean - Returns true if value is a constructor,
else false.
| Param | Type | Description |
| --- | --- | --- |
| value | \* | The value to check. |
value is callable.Kind: inner method of is-x
Returns: boolean - Returns true if value is callable, else false.
| Param | Type | Description |
| --- | --- | --- |
| value | \* | The value to check. |
value is classified as a RegExp object.Kind: inner method of is-x
Returns: boolean - Returns true if value is correctly classified,
else false.
| Param | Type | Description |
| --- | --- | --- |
| value | \* | The value to check. |
value is not a primitive.Kind: inner method of is-x
Returns: boolean - Returns true if value is an object, else false.
| Param | Type | Description |
| --- | --- | --- |
| value | \* | The value to check. |
value is object-like. A value is object-like if it's not aKind: inner method of is-x
Returns: boolean - Returns true if value is object-like,
else false.
| Param | Type | Description |
| --- | --- | --- |
| value | \* | The value to check. |
value's string tag is the supplied stringTag.Kind: inner method of is-x
Returns: boolean - Returns true if value's the string tag matchesstringTag, else false.
| Param | Type | Description |
| --- | --- | --- |
| value | \* | The value to check. |
| stringTag | string | The value to check. |
value is classified as an Array object.Kind: inner method of is-x
Returns: boolean - Returns true if value is an Array, else false.
| Param | Type | Description |
| --- | --- | --- |
| value | \* | The value to check. |
value is array-like. A value is considered array-like if it'svalue.length that's an integer greater than or0 and less than or equal to Number.MAX_SAFE_INTEGER.Kind: inner method of is-x
Returns: boolean - Returns true if value is array-like, else false.
| Param | Type | Description |
| --- | --- | --- |
| value | \* | The value to check. |
Kind: inner method of is-x
Returns: boolean - Returns true if prototypeObj is in object's
prototype chain, else false.
| Param | Type | Description |
| --- | --- | --- |
| prototypeObj | \* | An object to be tested against each link in the prototype chain of the object argument. |
| object | \* | The object whose prototype chain will be searched. |
Kind: inner method of is-x
Returns: boolean - Returns true if value is frozen, else false.
| Param | Type | Description |
| --- | --- | --- |
| value | \* | The value to check. |
Kind: inner method of is-x
Returns: boolean - Returns true if value is sealed, else false.
| Param | Type | Description |
| --- | --- | --- |
| value | \* | The value to check. |
Kind: inner method of is-x
Returns: boolean - true if the two values are the same value, else
false.
| Param | Type | Description |
| --- | --- | --- |
| value1 | \* | The first value to compare. |
| value2 | \* | The second value to compare. |
is doesn't coerceisSameValueZero differs from is only in its treatment of +0 and -0.
Kind: inner method of is-x
Returns: boolean - true if the two values are the same value, else
false.
| Param | Type | Description |
| --- | --- | --- |
| value1 | \* | The first value to compare. |
| value2 | \* | The second value to compare. |
-0.Kind: inner method of is-x
Returns: boolean - Returns true if value is -0, else false.
| Param | Type | Description |
| --- | --- | --- |
| value | \* | The value to check. |
Kind: inner method of is-x
Returns: boolean - Returns true if value is extensible, else false.
| Param | Type | Description |
| --- | --- | --- |
| value | \* | The value to check. |
value is an integer.Kind: inner method of is-x
Returns: boolean - Returns true if value is an integer, else false.
| Param | Type | Description |
| --- | --- | --- |
| value | \* | The value to check. |
value is a safe integer. An integer is safe if it'sKind: inner method of is-x
Returns: boolean - Returns true if value is a safe integer,
else false.
| Param | Type | Description |
| --- | --- | --- |
| value | \* | The value to check. |
Kind: inner method of is-x
Returns: boolean - Returns true if value is a property key,
else false.
| Param | Type | Description |
| --- | --- | --- |
| value | \* | The value to check. |
value is a valid array-like length.Kind: inner method of is-x
Returns: boolean - Returns true if value is a valid length,
else false.
| Param | Type | Description |
| --- | --- | --- |
| value | \* | The value to check. |
value is a native function.Kind: inner method of is-x
Returns: boolean - Returns true if value is a native function,
else false.
| Param | Type | Description |
| --- | --- | --- |
| value | \* | The value to check. |
Kind: inner method of is-x
Returns: boolean - true if actual and expected are deemed equal,
otherwise false. Circular objects will return false.
See: https://nodejs.org/api/assert.html
| Param | Type | Description |
| --- | --- | --- |
| value1 | \* | First comparison object. |
| value2 | \* | Second comparison object. |
Kind: inner method of is-x
Returns: boolean - true if actual and expected are deemed equal,
otherwise false. Circular objects will return false.
See: https://nodejs.org/api/assert.html
| Param | Type | Description |
| --- | --- | --- |
| value1 | \* | First comparison object. |
| value2 | \* | Second comparison object. |
true if the string indicating the type of thetypeOfString.Kind: inner method of is-x
Returns: boolean - true if the typeof object string matchestypeOfString, else false.
| Param | Type | Description |
| --- | --- | --- |
| value | \* | The object to test. |
| typeOfString | string | The typeof string to test. |
is a node's Buffer class.Kind: inner method of is-x
Returns: boolean -
true if the object is a Buffer, else false. | Param | Type | Description |
| --- | --- | --- |
| object | \* | The object to test. |
object is an ArrayBuffer.Kind: inner method of is-x
Returns: boolean - true if the object is an ArrayBuffer,
else false.
| Param | Type | Description |
| --- | --- | --- |
| object | \* | The object to test. |
is a DataView.Kind: inner method of is-x
Returns: boolean -
true if the object is a DataView,
else false. | Param | Type | Description |
| --- | --- | --- |
| object | \* | The object to test. |
true if the object has the specified property.Kind: inner method of is-x
Returns: boolean - true if the object has the specified property,
else false.
| Param | Type | Description |
| --- | --- | --- |
| object | \* | The object to test. |
| property | string | Symbol | The name or Symbol of the property to test. |
is in the specified
object.Kind: inner method of is-x
Returns: boolean -
true if the property is set on object, else
false. | Param | Type | Description |
| --- | --- | --- |
| object | \* | The object to test. |
| property | string | Symbol | The name or Symbol of the property to test. |
$3
Determine if an object is an Arrow Function.Kind: inner method of is-x
Returns: boolean -
true if the object is an Arrow Function,
else false. | Param | Type | Description |
| --- | --- | --- |
| object | \* | The object to test. |
value is an Error type.Kind: inner method of is-x
Returns: boolean - Returns true if value is an Error type,
else false.
| Param | Type | Description |
| --- | --- | --- |
| value | \* | The object to be tested. |
value is a Map.Kind: inner method of is-x
Returns: boolean - Returns true if value is a Map, else false.
| Param | Type | Description |
| --- | --- | --- |
| value | \* | The object to be tested. |
value is a Set.Kind: inner method of is-x
Returns: boolean - Returns true if value is a Set, else false.
| Param | Type | Description |
| --- | --- | --- |
| value | \* | The object to be tested. |
name.Kind: inner method of is-x
Returns: boolean - Returns true if function name is a name,
else false.
| Param | Type | Description |
| --- | --- | --- |
| fn | function | The function to be tested. |
| name | string | The object to be tested. |
Kind: inner method of is-x
Returns: boolean - Returns true if function is anonymous, else false.
| Param | Type | Description |
| --- | --- | --- |
| fn | function | The function to be tested. |
arity.Kind: inner method of is-x
Returns: boolean - Returns true if the function's arity matched arity,
else false.
| Param | Type | Description |
| --- | --- | --- |
| fn | function | The function to be tested. |
| arity | number | The arity integer to be tested. |
Kind: inner method of is-x
Returns: boolean - Returns true if the function an ES6 generator
function, else false.
| Param | Type | Description |
| --- | --- | --- |
| fn | function | The function to be tested. |