- 履歴一覧
- ソース を表示
- メモ は削除されています。
- 1 (2018-05-11 (金) 19:11:48)
- 2 (2018-05-14 (月) 10:10:19)
- 3 (2018-05-14 (月) 10:27:10)
function FirstClassCollection() { this.__content; } FirstClassCollection.prototype.size = function () { return this.__content.length; }; FirstClassCollection.prototype.map = function (...args) { const newCollection = Object.create(Object.getPrototypeOf(this)); newCollection.__content = this.__content.map(...args); return newCollection; }; function asFirstClassCollection(target) { Object.setPrototypeOf(target, FirstClassCollection.prototype); return target; }
function RaisableCollection() { this.__content; } Object.setPrototypeOf(RaisableCollection.prototype, FirstClassCollection.prototype); RaisableCollection.prototype.raise = function() { return this.map(value => value * value) }; function asRaisableCollection(target) { Object.setPrototypeOf(target, RaisableCollection.prototype); return target; }