MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / defineIterator

Function defineIterator

lib/web/polyfill.js:498–517  ·  view source on GitHub ↗
(Constructor, NAME, value, DEFAULT)

Source from the content-addressed store, hash-verified

496 setToStringTag(Constructor, NAME + ' Iterator');
497}
498function defineIterator(Constructor, NAME, value, DEFAULT){
499 var proto = Constructor[PROTOTYPE]
500 , iter = get(proto, SYMBOL_ITERATOR) || get(proto, FF_ITERATOR) || (DEFAULT && get(proto, DEFAULT)) || value;
501 if(framework){
502 // Define iterator
503 setIterator(proto, iter);
504 if(iter !== value){
505 var iterProto = getPrototypeOf(iter.call(new Constructor));
506 // Set @@toStringTag to native iterators
507 setToStringTag(iterProto, NAME + ' Iterator', true);
508 // FF fix
509 has(proto, FF_ITERATOR) && setIterator(iterProto, returnThis);
510 }
511 }
512 // Plug for library
513 Iterators[NAME] = iter;
514 // FF & v8 fix
515 Iterators[NAME + ' Iterator'] = returnThis;
516 return iter;
517}
518function defineStdIterators(Base, NAME, Constructor, next, DEFAULT, IS_SET){
519 function createIter(kind){
520 return function(){

Callers 1

defineStdIteratorsFunction · 0.85

Calls 5

setIteratorFunction · 0.85
setToStringTagFunction · 0.85
getFunction · 0.70
hasFunction · 0.70
callMethod · 0.45

Tested by

no test coverage detected