Skip to content

Commit bd1d041

Browse files
authored
Implement .intoObject() #21 (#24)
1 parent 3d5ff82 commit bd1d041

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

lib/main.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ export const Iterator = {
312312
},
313313

314314
/**
315-
* converts iterator into an array.
315+
* collects the iterator into an array.
316316
*
317317
* @return {Array}
318318
*/
@@ -321,7 +321,7 @@ export const Iterator = {
321321
},
322322

323323
/**
324-
* converts iterator into a set.
324+
* collects the iterator into a set.
325325
*
326326
* @return {Set}
327327
*/
@@ -330,12 +330,21 @@ export const Iterator = {
330330
},
331331

332332
/**
333-
* converts iterator into a map.
333+
* collects the iterator into a map.
334334
*
335335
* @return {Map}
336336
*/
337337
intoMap() {
338338
return new Map(this.ref);
339+
},
340+
341+
/**
342+
* collects the iterator into an object.
343+
*
344+
* @return {object}
345+
*/
346+
intoObject() {
347+
return Object.fromEntries(this.ref);
339348
}
340349
};
341350

0 commit comments

Comments
 (0)