blob: ae06ed0ef4b8cff4f58d95c6d1f3eeb0febcc89d [file] [log] [blame]
function RangeIterator(range) {
this.range = range;
this.current = this.range.low;
}
function hasKey(object, key) {
var original = object.__proto__, result;
object.__proto__ = null;
result = key in object;
object.__proto__ = original;
return result;
}
RangeIterator.prototype.next = function next() {
if (this.current > this.range.high) {
throw new Error();
} else {
return this.current++;
}
};
function Range(low, high) {
this.low = low;
this.high = high;
}
function SubArray(length) {
var result = arguments.length === 1 ? Array(length) : Array.apply(this, arguments);
result.__proto__ = SubArray.prototype;
return result;
}
SubArray.prototype.__proto__ = Array.prototype;
// Nothing wrong with a function named __proto__
function __proto__() {
return "I have a stupid name!";
}