'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; }; module.exports = function array_walk(array, funcname, userdata) { // eslint-disable-line camelcase // discuss at: http://locutus.io/php/array_walk/ // original by: Johnny Mast (http://www.phpvrouwen.nl) // bugfixed by: David // improved by: Brett Zamir (http://brett-zamir.me) // note 1: Only works with user-defined functions, not built-in functions like void() // example 1: array_walk ([3, 4], function () {}, 'userdata') // returns 1: true // example 2: array_walk ('mystring', function () {}) // returns 2: false // example 3: array_walk ({"title":"my title"}, function () {}) // returns 3: true if (!array || (typeof array === 'undefined' ? 'undefined' : _typeof(array)) !== 'object') { return false; } try { if (typeof funcname === 'function') { for (var key in array) { if (arguments.length > 2) { funcname(array[key], key, userdata); } else { funcname(array[key], key); } } } else { return false; } } catch (e) { return false; } return true; }; //# sourceMappingURL=array_walk.js.map