is-x

1.0.12 • Public • Published

is-x

Travis status Dependency status devDependency status npm version

A collection of the best JavaScript type testing methods.

ECMAScript compatibility shims for legacy JavaScript engines

es5-shim.js monkey-patches a JavaScript context to contain all EcmaScript 5 methods that can be faithfully emulated with a legacy JavaScript engine.

es5-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 Xotic750@gmail.com
License: MIT
Copyright: Xotic750

is-x~isElementboolean

Checks if 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.

is-x~isSurrogatePairboolean

Tests if the two character arguments combined are a valid UTF-16 surrogate pair.

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.

is-x~isNil(value)boolean

Checks if 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.

is-x~isNull(value)boolean

Checks if 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.

is-x~isUndefined(value)boolean

Checks if 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.

is-x~isEqual(value1, value2)boolean

Checks if 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.

is-x~isStrictEqual(value1, value2)boolean

Checks if 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.

is-x~isGt(value1, value2)boolean

Checks if 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.

is-x~isGte(value1, value2)boolean

Checks if 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.

is-x~isLt(value1, value2)boolean

Checks if 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.

is-x~isLte(value1, value2)boolean

Checks if 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.

is-x~isArguments(value)boolean

Checks if 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.

is-x~isString(value)boolean

Checks if 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.

is-x~isBoolean(value)boolean

Checks if 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.

is-x~isNumber(value)boolean

Checks if 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.

is-x~isDate(value)boolean

Checks if 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.

is-x~isNaN(value)boolean

Checks if 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.

is-x~isFinite(value)boolean

Checks if 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.

is-x~isSymbol(value)boolean

Checks if 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.

is-x~isTypedArray(value)boolean

Checks if 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.

is-x~isPrimitive(value)boolean

Checks if 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.

is-x~isPlainObject()boolean

Checks if value is a plain object, that is, an object created by the Object 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.

is-x~isCallable(value)boolean

Checks if 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.

is-x~isConstructor(value)boolean

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.

is-x~isFunction(value)boolean

Checks if 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.

is-x~isRegExp(value)boolean

Checks if 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.

is-x~isObject(value)boolean

Checks if 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.

is-x~isObjectLike(value)boolean

Checks if value is object-like. A value is object-like if it's not a primitive and not a function.

Kind: inner method of is-x
Returns: boolean - Returns true if value is object-like, else false.

Param Type Description
value * The value to check.

is-x~isStringTag(value, stringTag)boolean

Checks if value's string tag is the supplied stringTag.

Kind: inner method of is-x
Returns: boolean - Returns true if value's the string tag matches stringTag, else false.

Param Type Description
value * The value to check.
stringTag string The value to check.

is-x~isArray(value)boolean

Checks if 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.

is-x~isArrayLike(value)boolean

Checks if value is array-like. A value is considered array-like if it's not a function and has a value.length that's an integer greater than or equal to 0 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.

is-x~isProtoOf(prototypeObj, object)boolean

This method allows you to check whether or not an object exists within another object's prototype chain.

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.

is-x~isFrozen(value)boolean

An object is frozen if and only if it is not extensible, all its properties are non-configurable, and all its data properties (that is, properties which are not accessor properties with getter or setter components) are non-writable.

Kind: inner method of is-x
Returns: boolean - Returns true if value is frozen, else false.

Param Type Description
value * The value to check.

is-x~isSealed(value)boolean

Returns true if the object is sealed, otherwise false. An object is sealed if it is not extensible and if all its properties are non-configurable and therefore not removable (but not necessarily non-writable).

Kind: inner method of is-x
Returns: boolean - Returns true if value is sealed, else false.

Param Type Description
value * The value to check.

is-x~is(value1, value2)boolean

This method determines whether two values are the same value. Two values are the same if one of the following holds:

  • both undefined
  • both null
  • both true or both false
  • both strings of the same length with the same characters
  • both the same object
  • both numbers and
  • both +0
  • both -0
  • both NaN
  • both non-zero and both not NaN and both have the same value This is not the same as being equal according to the == operator. The == operator applies various coercions to both sides (if they are not the same Type) before testing for equality (resulting in such behavior as "" == false being true), but Object.is doesn't coerce either value.

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-x~isSameValueZero(value1, value2)boolean

This method determines whether two values are the same value. Two values are the same if one of the following holds:

  • both undefined
  • both null
  • both true or both false
  • both strings of the same length with the same characters
  • both the same object
  • both numbers and
  • both 0 regardless of sign
  • both NaN
  • both non-zero and both not NaN and both have the same value This is not the same as being equal according to the == operator. The == operator applies various coercions to both sides (if they are not the same Type) before testing for equality (resulting in such behavior as "" == false being true), but is doesn't coerce either value.

isSameValueZero 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.

is-x~isNegativeZero(value)boolean

Determines if an object is -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.

is-x~isExtensible(value)boolean

Determines if an object is extensible (whether it can have new properties added to it).

Kind: inner method of is-x
Returns: boolean - Returns true if value is extensible, else false.

Param Type Description
value * The value to check.

is-x~isInteger(value)boolean

Checks if 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.

is-x~isSafeInteger(value)boolean

Checks if value is a safe integer. An integer is safe if it's an IEEE-754 double precision number which isn't the result of a rounded unsafe integer.

Kind: 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.

is-x~isPropertyKey(value)boolean

The abstract operation IsPropertyKey determines if argument, which must be an ECMAScript language value or a Completion Record, is a value that may be used as a property key.

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.

is-x~isLength(value)boolean

Checks if 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.

is-x~isNative(value)boolean

Checks if 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.

is-x~isDeepEqual(value1, value2)boolean

Tests for deep equality. Primitive values are compared with the equal comparison operator ( == ). This only considers enumerable properties. It does not test object prototypes, attached symbols, or non-enumerable properties. This can lead to some potentially surprising results

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.

is-x~isStrictDeepEqual(value1, value2)boolean

Tests for deep equality. Primitive values are compared with the equal comparison operator ( === ).

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.

is-x~isTypeOf(value, typeOfString)boolean

This method returns true if the string indicating the type of the unevaluated operand matches typeOfString.

Kind: inner method of is-x
Returns: boolean - true if the typeof object string matches typeOfString, else false`.

Param Type Description
value * The object to test.
typeOfString string The typeof string to test.

is-x~isBuffer(object)boolean

Determine if an object is a node's Buffer class.

Kind: inner method of is-x
Returns: boolean - true if the object is a Buffer, else false`.
See: https://iojs.org/api/buffer.html

Param Type Description
object * The object to test.

is-x~isArrayBuffer(object)boolean

Determine if an 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-x~isDataView(object)boolean

Determine if an object 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.

is-x~isOwnPropertyOf(object, property)boolean

This method returns 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-x~isPropertyOf(object, property)boolean

This method returns true if the specified property 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.

is-x~isArrowFunction(object)boolean

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.

is-x~isError(value)boolean

Determine whether or not a given 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.

is-x~isMap(value)boolean

Determine whether or not a given 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.

is-x~isSet(value)boolean

Determine whether or not a given 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.

is-x~isFunctionName(fn, name)boolean

Determine whether or not a given function is named 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.

is-x~isAnonymous(fn)boolean

Determine whether or not a given function is anonymous.

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.

is-x~isArity(fn, arity)boolean

Determine whether or not a given function's arity matches 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.

is-x~isGenerator(fn)boolean

Determine whether or not a given function is an ES6 generator function.

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.

Package Sidebar

Install

npm i is-x

Weekly Downloads

1

Version

1.0.12

License

MIT

Last publish

Collaborators

  • xotic750