Object Iterable
Create a new object containing the same properties (through assignment) of another object along with an @@iterator method can make use of the default iteration behavior (such as for-of) that built-in iterables like Array or Map have.
npm install --save object-iterable
Let's see an example
const larry = name: 'Larry Johnson' alias: 'Grandmama' position: 'Power Forward' 'Small Forward' weight: 250 height: feet: 6 inches: 6 college: 'UNLV' draft: team: 'Charlotte Hornets' year: 1991 pick: 1 ; for let val of larry console;// Uncaught TypeError: larry[Symbol.iterator] is not a function
Oh nos!
But we can get through this.
Here an iterable new object is returned with all the same properties (which after use can optionally be kept or discarded).
; const iterableLarry = ; for let val of iterableLarry console;// Larry Johnson// Grandmama// ["Power Forward","Small Forward"]// 250// {"feet":6,"inches":6}// UNLV// {"team":"Charlotte Hornets","year":1991,"pick":1} console;// false