range.js

来自「Prototype的目标是为开发动态Web程序提供一个容易使用的JS开发框架」· JavaScript 代码 · 共 29 行

JS
29
字号
ObjectRange = Class.create();Object.extend(ObjectRange.prototype, Enumerable);Object.extend(ObjectRange.prototype, {  initialize: function(start, end, exclusive) {    this.start = start;    this.end = end;    this.exclusive = exclusive;  },    _each: function(iterator) {    var value = this.start;    do {      iterator(value);      value = value.succ();    } while (this.include(value));  },    include: function(value) {    if (value < this.start)       return false;    if (this.exclusive)      return value < this.end;    return value <= this.end;  }});var $R = function(start, end, exclusive) {  return new ObjectRange(start, end, exclusive);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?