Repository URL to install this package:
|
Version:
6.0.4 ▾
|
export interface AnyObj {
[key: string]: any;
[key: number]: any;
}
export declare type AnyArray = Array<any>;
export declare type AnyArrayOrObj = (AnyObj & AnyArray) | AnyObj | AnyArray;
/**
* 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`.
*
* @since 5.0.0-beta.6
* @memberOf loop
*
* @param {Object} object The object to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @return {Object} object passed in originally
*
* @fork 0.3.0
* @category Object
*
* @NOTE for array, object, and string, iterates over property/index/key
* @TODO !!! did not return object, consistently the others do, why?
*
* @see forEach, forEachRight, forIn, forInRight, forOwnRight
* {@link https://github.com/lodash/lodash/blob/master/forOwn.js lodash-forown}
* @see {@link lodash-forown}
*
* @example
*
* function Foo() {
* this.a = 1
* this.b = 2
* }
*
* Foo.prototype.c = 3
*
* forOwn(new Foo, (value, key) => console.log(key))
* //=> Logs 'a' then 'b' (iteration order is not guaranteed).
*
*/
declare function forOwn(object: AnyObj, iteratee: (value: any, key: string | number | symbol, list: AnyObj) => void): any;
export default forOwn;