Either gets the type of a value or adds a constructor registering its custom type name.

This function is valid in v2.8.0 to v2.24.2. This function has been downloaded 68 times.


{*} value
A value whose type name will be returned. Alternatively if opt_typeNameToAdd is passed this must be the constructor for the corresponding type name.
{string=} opt_typeNameToAdd Optional
If specified, value will be looked for within an array of all known constructors and if not found a new entry will be added along with this given type name.


If opt_typeNameToAdd was omitted a string representation of value's type usually capitalized unless "null" or "undefined" is returned. If opt_typeNameToAdd is given, the constructor passed as value will be searched and a boolean indicating whether or not it needed to be added will be returned.

Required Functions

This function directly requires the following functions which are included automatically:

  • isPrimitive()
    Determines if something is a primitive or not. If not a primitive it must be some form of object.
  • isPrototype()
    Determines if an object is a prototype object.
  • kindsOf()
    Retrieves all of the associated type names for a value.

Requiring Functions

This function is directly required by the following functions:

  • around()
    Gets the substrings around a specific target.
  • call()
    Calls a function whether it be a global prototype function or a YourJS function or a custom bindable.
  • calls()
    Makes multiple calls using the YourJS call() function.
  • chain()
    Creates a chained version of a value.
  • count()
    Count how many items in an array or an object pass a given tester function.
  • countBy()
    Creates or augments an object, making new properties that correspond to values in the given array. Each property added will indicate how many items in the array corresponding to those property names.
  • css()
    Creates a CSS stylesheet from an JSON representation of a stylesheet.
  • dice()
    Dices up a string splitting it on the passed in delimiter and placing the results in an array while making sure that the empty string is converted to an empty array.
  • dom()
    Creates HTML DOM objects.
  • expandRegExp()
    Expands regular expressions by expanding the character classes. Supports [:alnum:], [:alpha:], [:digit:], [:punct:], [:space:], or [:xdigit:] and allows for addition of other character classes.
  • findByProp()
    Looks for the first value in an array whose given property matches the criteria.
  • findNth()
    Gets the nth value matching target in subject.
  • flatten()
    Create a flattened copy of an array.
  • forEach()
    Traverses all the characters in a string or all of the elements in an array or an array-like object, executing a function on each one.
  • forOf()
    Traverses all the characters in a string or all of the items in an array or an object, executing a function on each one.
  • getCookie()
    Retrieves one or more cookies.
  • indexOf()
    Gets the index of a specified target value in a string, array or an object. Unlike Array.prototype.indexOf(), this function works for finding NaN and differentiates between -0 and 0.
  • isArguments()
    Determines if the given value is of type Arguments as specified by typeOf().
  • isArrayLike()
    Determines if an object is an array or at least array-like.
  • isError()
    Determines if a value is an Error object.
  • isFullOf()
    Determines if an array, array-like object, or an object is full of items that match a specific type or tester function.
  • isType()
    Determines if a value is of a specific type or one of a list of specific types.
  • isTypeFor()
    Creates a partial isType() function.
  • kindsOf()
    Retrieves all of the associated type names for a value.
  • modURL()
    Modifie a URL.
  • parseQS()
    Parses a URL to get the parameters specified in the query string.
  • replace()
    Replace targeted substrings with new strings.
  • uneval()
    Creates a string representation of the given object or primitive.