"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = forEach;


/**
 * Invoke a function for every key within given object or array.
 * @name forEach
 * @param {object} obj object or array to iterate 
 * @param {function} cb callback function to invoke
 * @example 
 * ```js
 *  forEach({ a: 1, b: 2, c: 3 }, (val, key) => console.log(key, val));
 *  // => a 1 b 2 c 3
 * ```
 */
function forEach(obj, cb) {
  var keys = Object.keys(obj);
  keys.forEach(function (key) {
    return cb(obj[key], key);
  });
}