const normalizeMessage = function (message) { const messageA = stripAnsi(message) const messageB = REPLACEMENTS.reduce(replacePart, messageA) const messageC = messageB.trim() return messageC }
function login(req, res){ var nickname = url.parse(req.url, true).query.username; if(nickname && nickname.trim() != ''){ // TODO: session에 대화명 저장 res.writeHead(303, {Location: '/chat'}); }else{ res.writeHead(303, {Location: '/'}); } res.end(); }
/** * Evaluate child nodes as text. For use in child class getText methods. * @return {String} */ evaluateChildren (respond) { async.concat(this.children, function (item, callback) { item.getText(callback); }, function (err, results) { if (typeof results !== 'string') { results = results.join(''); } respond(err, results.trim()); }); }
/** * Установить словарь. * * @param {string|string[]} dict */ set(dict) { this.clear(); if (!dict) { return; } const buffer = Array.isArray(dict) ? dict : dict.trim().split(/\r?\n/); for (const word of buffer) { this.addWord(word); } }
/** * 문단(들)을 품사분석합니다. (Synchronous) * @param {...(string|string[])} text 분석할 문단들. 텍스트와 string 리스트 혼용 가능. (가변인자) * @returns {Sentence[]} 분석된 결과 (Flattened list) */ tagSync(...text) { let result = []; for (let paragraph of text) { if (Array.isArray(paragraph)) { result.push(...this.tagSync(...paragraph)); } else { if (paragraph.trim().length == 0) continue; result.push(...JVM.toJsArray(this._api.tag(paragraph), (x) => new Sentence(x))); } } return result; }
/** * Get the list of channels to enable commands in based on the parameters * @param {string|Array<Channel>} channelsParam parameter for determining channels * @param {Message} message Discord message to get information on channels * @returns {Array<string>} channel ids to enable commands in */ const getChannels = (channelsParam, message) => { let channels = []; // handle it for strings if (channelsParam !== 'all' && channelsParam !== 'current' && channelsParam !== '*') { channels.push(message.guild.channels.cache.get(channelsParam.trim().replace(/(<|>|#)/ig, ''))); } else if (channelsParam === 'all' || channelsParam === '*') { channels = channels.concat(message.guild.channels.cache.filter(channel => channel.type === 'text').array()); } else if (channelsParam === 'current') { channels.push(message.channel); } return channels; }
/** * Get the list of channels to enable commands in based on the parameters * @param {string|Array<Channel>} channelsParam parameter for determining channels * @param {Message} message Discord message to get information on channels * @param {Collection.<Channel>} channels Channels allowed to be searched through * @returns {Array<string>} channel ids to enable commands in */ const getChannel = (channelsParam, message, channels) => { let { channel } = message; let channelsColl; if (message.guild) { channelsColl = message.guild.channels.cache; } else { channelsColl = new Collection(); channelsColl.set(message.channel.id, message.channel); } if (typeof channelsParam === 'string') { // handle it for strings if (channelsParam !== 'here') { channel = (channels || channelsColl).get(channelsParam.trim()); } else if (channelsParam === 'here') { // eslint-disable-next-line prefer-destructuring channel = message.channel; } } return channel; }
/** * 문단(들)을 품사분석합니다. (Asynchronous) * @param {...(string|string[])} text 분석할 문단들. 텍스트와 string 리스트 혼용 가능. (가변인자) * @returns {Sentence[]} 분석된 결과 (Flattened list) */ async tag(...text) { let result = []; for (let paragraph of text) { let promiseResult; if (Array.isArray(paragraph)) { promiseResult = await this.tag(...paragraph); result.push(...promiseResult); } else { if (paragraph.trim().length == 0) continue; promiseResult = await this._api.tagPromise(paragraph); result.push(..._jvm.JVM.toJsArray(promiseResult, x => new _data.Sentence(x))); } } return result; }
if(isEmpty(name.trim()))
if(isEmpty(name.trim()))
function login(req, res){ var nickname = url.parse(req.url, true).query.username; if(nickname && nickname.trim() != ''){ // TODO: session에 대화명 저장 req.session.nickname = nickname; res.writeHead(303, {Location: '/chat'}); }else{ res.writeHead(303, {Location: '/'}); } res.end(); }
/** * 문단(들)을 품사분석합니다. (Synchronous) * @param {...(string|string[])} text 분석할 문단들. 텍스트와 string 리스트 혼용 가능. (가변인자) * @returns {Sentence[]} 분석된 결과 (Flattened list) */ tagSync(...text) { let result = []; for (let paragraph of text) { if (Array.isArray(paragraph)) { result.push(...this.tagSync(...paragraph)); } else { if (paragraph.trim().length == 0) continue; result.push(..._jvm.JVM.toJsArray(this._api.tag(paragraph), x => new _data.Sentence(x))); } } return result; }
/** * 문단(들)을 품사분석합니다. (Asynchronous) * @param {...(string|string[])} text 분석할 문단들. 텍스트와 string 리스트 혼용 가능. (가변인자) * @returns {Sentence[]} 분석된 결과 (Flattened list) */ async tag(...text) { let result = []; for (let paragraph of text) { let promiseResult; if (Array.isArray(paragraph)) { promiseResult = await this.tag(...paragraph); result.push(...promiseResult); } else { if (paragraph.trim().length == 0) continue; promiseResult = await this._api.tagPromise(paragraph); result.push(...JVM.toJsArray(promiseResult, (x) => new Sentence(x))); } } return result; }