/** * Returns a boolean telling if the input property name is assigned to the input * * @param {string} name - name of the property * @return {boolean} */ hasProperty(name){ assert(TypeCheck.isString(name), 'property name needs to be defined as string'); return Input._allRegisteredProperties(this.constructor).has(name) || this[_properties].has(name); }
/** @private */ function typeCheck(values, ...types) { types = new Set(types); new Set(values.map(x => { let t = typeof x; if (t === 'object') t = x.constructor.name; return t; })).forEach(t => { assert(types.has(t), `[${[...types].toString()}] 중 하나를 기대했지만 ${t} 타입이 들어왔습니다!`); }); }
function getPokemonIcon(pokemonId, form = 0, evolution = 0, gender = 0, costume = 0, shiny = false) { const evolutionSuffixes = evolution ? ['-e' + evolution, ''] : ['']; const formSuffixes = form ? ['-f' + form, ''] : ['']; const costumeSuffixes = costume ? ['-c' + costume, ''] : ['']; const genderSuffixes = gender ? ['-g' + gender, ''] : ['']; const shinySuffixes = shiny ? ['-shiny', ''] : ['']; for (const evolutionSuffix of evolutionSuffixes) { for (const formSuffix of formSuffixes) { for (const costumeSuffix of costumeSuffixes) { for (const genderSuffix of genderSuffixes) { for (const shinySuffix of shinySuffixes) { const result = `${pokemonId}${evolutionSuffix}${formSuffix}${costumeSuffix}${genderSuffix}${shinySuffix}`; if (availableForms.has(result)) return result; } } } } } return '0'; // substitute }
/** * 如果插件没有在失败列表,则启动,否则忽略 * * @param {Plugin[]} failedToStartedPlugins * @param {Plugin} plugin * @memberof PluginStarter */ startPluginInternal(failedToStartedPlugins, plugin) { if (failedToStartedPlugins.has(plugin.id)) { return; } try { plugin.start(); } catch (error) { failedToStartedPlugins.add(plugin.id); } }
/** * Returns the property value for the input property name * * @param {string} name - name of the property * @return {Promise<*>} The value of the property otherwise raises an exception * in case the property is not assigned */ property(name){ assert(TypeCheck.isString(name), 'property name needs to be defined as string'); if (this[_properties].has(name)){ return this[_properties].get(name); } // checking if the property is valid const allRegisteredProperties = Input._allRegisteredProperties(this.constructor); if (allRegisteredProperties.has(name)){ return allRegisteredProperties.get(name); } throw new Error(`Property ${name} is not registered!`); }
if (!ignoreComments || !commentLineNumbers.has(location.line)) { report(node, location, fixRange);
return breakingSigns.has(c); },
/** @private */ export function typeCheck(values, ...types){ types = new Set(types); new Set(values.map((x) => { let t = typeof x; if (t === 'object') t = x.constructor.name; return t; })).forEach((t) => { assert(types.has(t), `[${[...types].toString()}] 중 하나를 기대했지만 ${t} 타입이 들어왔습니다!`); }); }