JavaScript Type Snippets

The JavaScript snippet collection contains a wide variety of ES6 helper functions. It includes helpers for dealing with primitives, arrays and objects, as well as algorithms, DOM manipulation functions and Node.js utilities.

  • Object.is() and the triple equals operator (===) can both be used for equality checking in JavaScript, but when should you use each one?

  • castArray

    JavaScript, Type

    Casts the provided value as an array if it's not one.

  • cloneRegExp

    JavaScript, Type

    Clones a regular expression.

  • coalesce

    JavaScript, Type

    Returns the first defined, non-null argument.

  • isFunction

    JavaScript, Type

    Checks if the given argument is a function.

  • isObject

    JavaScript, Type

    Checks if the passed value is an object or not.

  • isObjectLike

    JavaScript, Type

    Checks if a value is object-like.

  • isString

    JavaScript, Type

    Checks if the given argument is a string. Only works for string primitives.

  • isBoolean

    JavaScript, Type

    Checks if the given argument is a native boolean element.

  • isNumber

    JavaScript, Type

    Checks if the given argument is a number.

  • isSymbol

    JavaScript, Type

    Checks if the given argument is a symbol.

  • isNil

    JavaScript, Type

    Checks if the specified value is null or undefined.

  • isNull

    JavaScript, Type

    Checks if the specified value is null.

  • isUndefined

    JavaScript, Type

    Checks if the specified value is undefined.