Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "utils/for-in/docs/types/index.d"

Index

Functions

Functions

Export assignment forIn

  • forIn(obj: any, fcn: Function, thisArg?: any): any
  • Invokes a function once for each own and inherited enumerable property of an object.

    Notes

    • When invoked, the function is provided three arguments:

      • value: object property value
      • key: object property
      • obj: the input object
    • To terminate iteration before visiting all properties, the provided function must explicitly return false.

    • Iteration order is not guaranteed.

    Parameters

    • obj: any

      input object

    • fcn: Function

      function to invoke

    • Optional thisArg: any

      execution context

    Returns any

    obj - input object

    Example

    function log( v, key ) {
        console.log( '%s: %d', key, v );
    }
    
    function Foo() {
        this.a = 1;
        this.b = 2;
        return this;
    }
    
    Foo.prototype.c = 3;
    Foo.prototype.d = 4;
    
    var obj = new Foo();
    
    forIn( obj, log );