mirror of
https://github.com/flynx/types.js.git
synced 2025-10-29 02:20:07 +00:00
notes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
2def3e2749
commit
632edfdab6
2
Array.js
2
Array.js
@ -489,11 +489,13 @@ object.Mixin('ArrayProtoMixin', 'soft', {
|
||||
// -> iterator
|
||||
//
|
||||
// XXX should this take an argument and be like map??
|
||||
// XXX this should handle throwing STOP!!!
|
||||
iter: function*(handler=undefined){
|
||||
if(handler){
|
||||
var i = 0
|
||||
for(var e of this){
|
||||
var res = handler.call(this, e, i++)
|
||||
// treat non-iterables as single elements...
|
||||
if(typeof(res) == 'object'
|
||||
&& Symbol.iterator in res){
|
||||
yield* res
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user