Home

function: forOwn


forOwn(object: Object, iteratee: function): void

Iterates over own enumerable string keyed properties of an object and invokes `iteratee` for each property. The iteratee is invoked with three arguments: (value, key, object). Iteratee functions may exit iteration early by explicitly returning `false`.

Example(s):

function Foo() {
  this.a = 1
  this.b = 2
}

Foo.prototype.c = 3

forOwn(new Foo, function(value, key) {
  console.log(key)
})
// => Logs 'a' then 'b' (iteration order is not guaranteed).

Params:

Name Type Attribute Description
object The object to iterate over.
iteratee The function invoked per iteration.

Returns:

void

  {
    "comment": "/**\r\n * Iterates over own enumerable string keyed properties of an object and\r\n * invokes `iteratee` for each property. The iteratee is invoked with three\r\n * arguments: (value, key, object). Iteratee functions may exit iteration\r\n * early by explicitly returning `false`.\r\n *\r\n * @since 0.3.0\r\n * @category Object\r\n * @param {Object} object The object to iterate over.\r\n * @param {Function} iteratee The function invoked per iteration.\r\n * @see forEach, forEachRight, forIn, forInRight, forOwnRight\r\n * @example\r\n *\r\n * function Foo() {\r\n *   this.a = 1\r\n *   this.b = 2\r\n * }\r\n *\r\n * Foo.prototype.c = 3\r\n *\r\n * forOwn(new Foo, function(value, key) {\r\n *   console.log(key)\r\n * })\r\n * // => Logs 'a' then 'b' (iteration order is not guaranteed).\r\n */",
    "meta": {
        "range": [
            754,
            908
        ],
        "filename": "forOwn.js",
        "lineno": 26,
        "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
        "code": {
            "id": "astnode100002950",
            "name": "forOwn",
            "type": "FunctionDeclaration",
            "paramnames": [
                "object",
                "iteratee"
            ]
        },
        "vars": {
            "": null
        }
    },
    "description": "Iterates over own enumerable string keyed properties of an object and\rinvokes `iteratee` for each property. The iteratee is invoked with three\rarguments: (value, key, object). Iteratee functions may exit iteration\rearly by explicitly returning `false`.",
    "since": "0.3.0",
    "tags": [
        {
            "originalTitle": "category",
            "title": "category",
            "text": "Object",
            "value": "Object"
        }
    ],
    "params": [
        {
            "type": {
                "names": [
                    "Object"
                ]
            },
            "description": "The object to iterate over.",
            "name": "object"
        },
        {
            "type": {
                "names": [
                    "function"
                ]
            },
            "description": "The function invoked per iteration.",
            "name": "iteratee"
        }
    ],
    "see": [
        "forEach, forEachRight, forIn, forInRight, forOwnRight"
    ],
    "examples": [
        "function Foo() {\r  this.a = 1\r  this.b = 2\r}\r\rFoo.prototype.c = 3\r\rforOwn(new Foo, function(value, key) {\r  console.log(key)\r})\r// => Logs 'a' then 'b' (iteration order is not guaranteed)."
    ],
    "name": "forOwn",
    "longname": "forOwn",
    "kind": "function",
    "scope": "global",
    "___id": "T000002R000315",
    "___s": true,
    "filepath": "forOwn.js"
}