mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 02:17:48 +00:00
Use more for-of
This commit is contained in:
@@ -12,12 +12,11 @@
|
||||
* // => { 'a': 1, 'b': 2 }
|
||||
*/
|
||||
function fromPairs(pairs) {
|
||||
let index = -1
|
||||
const length = pairs == null ? 0 : pairs.length
|
||||
const result = {}
|
||||
|
||||
while (++index < length) {
|
||||
const pair = pairs[index]
|
||||
if (pairs == null) {
|
||||
return result
|
||||
}
|
||||
for (const pair of pairs) {
|
||||
result[pair[0]] = pair[1]
|
||||
}
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user