目录
当前位置: 首页 > 文档资料 > Lazy.js 英文文档 >

moveNext

优质
小牛编辑
140浏览
2023-12-01

Moves the iterator to the next item in a sequence, if possible.

Signature

Iterator.moveNext = function() { /*...*/ }
Iterator.moveNext = function moveNext() {
  var cachedIndex = this.cachedIndex;

  if (!cachedIndex) {
cachedIndex = this.cachedIndex = this.sequence.getIndex();
  }

  if (this.index >= cachedIndex.length() - 1) {
return false;
  }

  ++this.index;
  return true;
}
NameType(s)Description
returnsboolean

True if the iterator is able to move to a new item, or else false.