本文整理汇总了TypeScript中diacritics.remove函数的典型用法代码示例。如果您正苦于以下问题:TypeScript remove函数的具体用法?TypeScript remove怎么用?TypeScript remove使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了remove函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: async
router.post('/save', async (req: any, res) => {
if (!req.user.admin) {
res.status(403);
return;
}
const ideogram = ideogramsConverter.convertIdeogramsToUtf16(
await ideogramsConverter.traditionalToSimplified(req.body.ideograms),
);
const pronunciation = req.body.pinyin.toLowerCase();
let response = await knex('cjk')
.where({
ideogram,
pronunciation,
})
.select('id');
if (!response.length) {
response = await knex('cjk')
.where({
ideogram,
main: 1,
})
.select('id');
}
if (response.length) {
const id = response[0].id;
await CjkRepository.save({
id,
definition_pt: JSON.stringify(req.body.dictionary),
});
} else {
const pronunciationUnaccented = removeDiacritics(pronunciation);
await CjkRepository.save({
ideogram,
ideogram_raw: req.body.ideograms,
main: 1,
pronunciation,
pronunciation_unaccented: pronunciationUnaccented,
language_id: 1,
simplified: 1,
hsk: 999,
type: 'W',
usage: 0,
created_at: new Date(),
definition_pt: JSON.stringify(req.body.dictionary),
});
const cacheKey = `PINYIN_${ideogram}`;
await ArrayCache.forget(cacheKey);
await RedisCache.forget(cacheKey);
}
res.setHeader('Content-Type', 'application/json');
res.send(JSON.stringify({}));
});
开发者ID:pierophp,项目名称:pinyin,代码行数:60,代码来源:unihan.controller.ts
示例2:
sels.forEach(selection => {
let text = d.getText(new vscode.Range(selection.start, selection.end));
let newText = DiacriticsRemover.remove(text);
e.edit(edit => {
edit.replace(selection, newText);
});
});
开发者ID:zemacik,项目名称:vscode-diakritika-sk-extension,代码行数:7,代码来源:extension.ts
示例3: extractPinyinTone
pinyin.forEach(syllable => {
let tone = extractPinyinTone(syllable);
if (tone === 0) {
tone = 5;
}
syllable = syllable.replace(/[ǖǘǚǜü]/, 'v');
pinyinTones += `${removeDiacritics(syllable)}${tone}`;
});
开发者ID:pierophp,项目名称:pinyin,代码行数:9,代码来源:pleco.export.ts
示例4: prepareAnswer
private prepareAnswer(answer: string): string {
return (diacritics.remove(answer) as string)
.toLowerCase()
.trim()
.replace(/\W/g, ' ');
}
开发者ID:QuentinFchx,项目名称:quizz,代码行数:6,代码来源:Question.ts
示例5:
import * as diacritics from "diacritics";
const replacementListItem = diacritics.replacementList[1];
// tslint:disable-next-line:no-unused-expression
replacementListItem.base === "0";
replacementListItem.chars === "\u07C0";
const mapItem = diacritics.diacriticsMap["A"];
// tslint:disable-next-line:no-unused-expression
diacritics.remove("foo") === "bar";
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:12,代码来源:diacritics-tests.ts
注:本文中的diacritics.remove函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论