3 ms·
A simple Object.keys(str|obj|etc...) call on your iterating object makes the other functions work on those data types too. Lodash may be fast, but recently I'v
by tedeh 8y ago
A simple Object.keys(str|obj|etc...) call on your iterating object makes the other functions work on those data types too.
Lodash may be fast, but recently I've been avoiding the basic "lodash function with native js equivalent" for one particular reason: stepping into js native functions when debugging (node inspect) is a breeze, and a complete nightmare when using lodash.
- venning 8y agoNo. Object.keys() does not allow iteration on strings or `arguments` or HTMLCollections. It only returns an array of indices not values. You can call Array#forEach() on the resultant array, but you'd need another iteratee signature to process them than you would for a proper forEach or for Lodash's method, or you'd have to dereference each element manually. At that point, you might as well run a for loop, since the code will be nearly identical.
- deleted 8y ago[deleted]