{
const Generator = Object.getPrototypeOf(function* () {});
Generator.prototype.map = function (transform) {
return Generators.map(this, transform);
};
Generator.prototype.filter = function (test) {
return Generators.filter(this, test);
};
Generator.prototype.valueAt = function (i) {
return Generators.valueAt(this, i);
};
Generator.prototype.take = function (count) {
const acc = [];
let result;
while (!(result = this.next()).done && count-- > 0) {
acc.push(result.value);
}
return acc;
};
Array.prototype.rotate = function (offset) {
const n = offset % this.length;
return this.slice(n, this.length).concat(this.slice(0, n));
};
}