UNPKG

nicolive-api

Version:
56 lines (47 loc) 2.05 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var Room = function () { _createClass(Room, null, [{ key: 'getIndex', value: function getIndex(label) { if (/c[oh]\d+/.test(label)) return 0; if (/バックステージパス/.test(label)) return 0; if (/アリーナ/.test(label)) return 0; if (/立ち見(\d)/.test(label)) return Number(label.match(/立ち見(\d)/)[1]); return null; } }]); function Room(label) { _classCallCheck(this, Room); this.label = label; this.index = Room.getIndex(label); } _createClass(Room, [{ key: 'next', value: function next() { if (Number.isInteger(this.index)) return new Room('\u7ACB\u3061\u898B' + (this.index + 1)); return new Room(''); } }, { key: 'previous', value: function previous() { if (this.index === 0) return new Room(''); if (this.index === 1) return new Room('アリーナ'); if (Number.isInteger(this.index)) return new Room('\u7ACB\u3061\u898B' + (this.index - 1)); return new Room(''); } }, { key: 'shortLabel', get: function get() { if (this.index === 0) return 'ア'; if (Number.isInteger(this.index)) return this.index; return ''; } }]); return Room; }(); exports.default = Room;