- Complete React app with 7 developer tools - JSON Tool with visual structured editor - Serialize Tool with visual structured editor - URL, Base64, CSV/JSON, Beautifier, Diff tools - Responsive navigation with dropdown menu - Dark/light mode toggle - Mobile-responsive design with sticky header - All tools working with copy/paste functionality
26 lines
741 B
JavaScript
26 lines
741 B
JavaScript
var keys = require('./keys.js');
|
|
var _optimizeCb = require('./_optimizeCb.js');
|
|
var _isArrayLike = require('./_isArrayLike.js');
|
|
|
|
// The cornerstone for collection functions, an `each`
|
|
// implementation, aka `forEach`.
|
|
// Handles raw objects in addition to array-likes. Treats all
|
|
// sparse array-likes as if they were dense.
|
|
function each(obj, iteratee, context) {
|
|
iteratee = _optimizeCb(iteratee, context);
|
|
var i, length;
|
|
if (_isArrayLike(obj)) {
|
|
for (i = 0, length = obj.length; i < length; i++) {
|
|
iteratee(obj[i], i, obj);
|
|
}
|
|
} else {
|
|
var _keys = keys(obj);
|
|
for (i = 0, length = _keys.length; i < length; i++) {
|
|
iteratee(obj[_keys[i]], _keys[i], obj);
|
|
}
|
|
}
|
|
return obj;
|
|
}
|
|
|
|
module.exports = each;
|