UNPKG

nicolive-api

Version:
56 lines (45 loc) 2.01 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 Community = function () { _createClass(Community, null, [{ key: "COMMUNITY_LEVEL_STAND_ROOM_COUNT_TABLE", get: function get() { return [[0, 49, 1], [50, 69, 2], [70, 104, 3], [105, 149, 4], [150, 189, 5], [190, 229, 6], [230, 255, 7], [256, 999, 9]]; } }]); function Community() { var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, global_id = _ref.global_id, name = _ref.name, description = _ref.description, level = _ref.level, thumbnail = _ref.thumbnail; _classCallCheck(this, Community); this.id = global_id; this.name = name; this.description = description; this.level = level; this.thumbnail = thumbnail; } _createClass(Community, [{ key: "isChannel", value: function isChannel() { return (/ch\d+/.test(this.id) ); } }, { key: "standRoomCount", value: function standRoomCount() { var _this = this; return Community.COMMUNITY_LEVEL_STAND_ROOM_COUNT_TABLE.find(function (el) { return el[0] <= _this.level && el[1] >= _this.level; })[2]; } }]); return Community; }(); exports.default = Community;