"use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /** * iterateObject * Iterates an object. Note the object field order may differ. * * @name iterateObject * @function * @param {Object} obj The input object. * @param {Function} fn A function that will be called with the current value, field name and provided object. * @return {Function} The `iterateObject` function. */ function iterateObject(obj, fn) { var i = 0, keys = []; if (Array.isArray(obj)) { for (; i < obj.length; ++i) { if (fn(obj[i], i, obj) === false) { break; } } } else if ((typeof obj === "undefined" ? "undefined" : _typeof(obj)) === "object" && obj !== null) { keys = Object.keys(obj); for (; i < keys.length; ++i) { if (fn(obj[keys[i]], keys[i], obj) === false) { break; } } } } module.exports = iterateObject;