forIn()

Runs through all of the properties of an object, executing a function for each property found.

This function is valid in v2.1.0 to v2.24.3. This function has been downloaded 63 times.

Parameters

{Object} obj
Object whose properties will be traversed.
{Function} fn
Function to call for each property in obj. The parameters passed are as follows: (1) value, (2) key, (3) obj and (4) ender function. The this keyword will contain the number of times the function has been called. The ender function may be used to immediately stop traversing obj. Calling the ender function with a true-ish value will instead make the ender function return a boolean value indicating if the ender function has already been called (useful only in a catch or finally clause).
{boolean=} opt_traverseAll Optional, Default:false
Boolean indicating whether or not even the properties that are not owned by obj should be traversed. If true all properties will be traversed.

Returns

{number}
Number of times fn was called.

Required Function

This function directly requires the following function which is included automatically:

  • has()
    Every object descended from Object inherits the hasOwnProperty method. This method can be used to determine whether an object has the specified property as a direct property of that object; unlike the in operator, this method does not check down the object's prototype chain.

Requiring Functions

This function is directly required by the following functions:

  • chain()
    Creates a chained version of a value.
  • 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.
  • partialAny()
    Creates a partial function where the arguments in any position can be set. Also allows for setting the value of this.