本文整理汇总了TypeScript中fuzzaldrin.score函数的典型用法代码示例。如果您正苦于以下问题:TypeScript score函数的具体用法?TypeScript score怎么用?TypeScript score使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了score函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
var all = _.map(Aliases.all, (alias: string, expanded: string) => {
return {
value: expanded,
score: 2 * (score(alias, lastLexeme) + (score(expanded, lastLexeme) * 0.5)),
synopsis: alias,
description: `Aliased to â${expanded}â.`,
type: 'alias',
}
});
示例2:
const scores = keys.map((key) => {
const ck = candidate[key]
if (ck) {
return FZ.score(ck.toString(), prefix)
} else {
return 0
}
})
示例3: score
var all = _.map(executables, (executable: string) => {
return {
value: executable,
score: 1.5 * score(executable, lastArgument),
synopsis: '',
description: descriptions[executable],
type: 'executable'
};
});
示例4: score
var all = ExecutionHistory.all.filter(entry => entry.raw.length > 3).map(entry => {
return {
value: entry.raw,
score: 0.1 * score(entry.raw, lastArgument),
synopsis: '',
description: '',
replaceAll: true,
type: 'history'
};
});
示例5: filter
import { match, filter, score } from 'fuzzaldrin';
let number = 0;
const string = '' as string;
let strings: string[] = [];
let objects: Array<{name: string, speed: number}> = [];
strings = filter(strings, string);
strings = filter(strings, string, {maxResults: number});
objects = filter(objects, string, {key: 'name'});
objects = filter(objects, string, {key: 'name', maxResults: number});
number = score(string, string);
match(string, string);
// These should be type errors! Uncomment to verify.
// objects = filter(objects, string);
// objects = filter(objects, string, {key: 'speed'});
// strings = filter(strings, string, {key: 'speed'});
示例6: score
var prepared = _._(all).each(suggestion => suggestion.score = score(suggestion.value, baseName))