Skip to content

Commit ad38072

Browse files
authored
Auto convert objects to iterator #22 (#25)
1 parent bd1d041 commit ad38072

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/main.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,16 @@ export const Iterator = {
311311
return { ref: value, __proto__: this };
312312
},
313313

314+
/**
315+
* Creates an iterator over the properties of an object
316+
*
317+
* @param {object} target
318+
* @return {Iterator}
319+
*/
320+
fromObject(target) {
321+
return this.new(Object.entries(target));
322+
},
323+
314324
/**
315325
* collects the iterator into an array.
316326
*

0 commit comments

Comments
 (0)