本文整理汇总了TypeScript中ramda.contains函数的典型用法代码示例。如果您正苦于以下问题:TypeScript contains函数的具体用法?TypeScript contains怎么用?TypeScript contains使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了contains函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1:
R.filter(role => {
// 判断返回的是否是 ids
if (user.roles && _.isObjectLike(user.roles[0])) {
return R.contains(role.id)(R.values(R.pluck('id', user.roles)));
}
return R.contains(role.id)(user.roles);
}),
开发者ID:danielwii,项目名称:asuna-admin,代码行数:7,代码来源:menu.redux.ts
示例2: compose
getIdOrNullFor = type => compose(
ifElse(isNil, always(null), compose(
ifElse(
contains(type),
compose<string, string[], string, number, Record<string, number>>(
objOf(`${type}_id`), Number, last, split('-'),
),
always(null),
),
)),
);
开发者ID:displague,项目名称:manager,代码行数:11,代码来源:createDevicesFromStrings.ts
示例3: newId
export const craftMinion = (props: CraftMinionProps): Minion => ({
abilities: [],
attacksPerformed: 0,
// TODO: refactor
exhausted: !!props.abilities && props.abilities.length > 0
? !R.contains(Ability.Charge, props.abilities)
: true,
destroyed: false,
health: props.maxHealth,
...props,
id: newId(),
type: CardType.Minion,
});
开发者ID:zernie,项目名称:typescript-redux-card-game,代码行数:13,代码来源:Minion.ts
示例4: function
route.query = function(context) {
// console.log(context);
context.query = queryParser(context.query || {});
context.method = route.method;
if (route.method === 'get') {
context.query.limit = context.query.limit || options.defaultLimit;
if (context.query.limit > options.maxItems) {
context.query.limit = options.maxItems;
}
}
let query = queryGenerator(context);
let base;
if (context.query.scope) {
base = sequelize.models[state.model].scope(context.query.scope);
}
else {
base = sequelize.models[state.model];
}
let f = base[methodMap[state.type][route.method]];
let fParams = [query];
if (R.contains(route.method, ['put', 'post', 'update'])) {
fParams.unshift(context.payload);
}
return f.apply(base, fParams).then((response) => {
if (route.method === 'put') {
let updated = response[1];
if (state.type === 'row') {
return updated.length === 0 ? null : updated[0];
}
else {
return updated;
}
}
if (route.method === 'delete') {
return {id: context.identifiers[state.identifier]};
}
else {
return response;
}
});
};
开发者ID:repositive,项目名称:hapi-path-generator,代码行数:49,代码来源:sequelizePaths.ts
示例5: getExplanationVideos
private getExplanationVideos(letter: string) {
if (contains(letter, ['a', 'e', 'n'])) {
return [
this.createExercise(ExerciseTypes.InfoScreen, {
type: 'TutorialVideo',
video: `explanation_find_letter_${letter}_w_letter`
}),
this.createExercise(ExerciseTypes.InfoScreen, {
type: 'TutorialVideo',
video: `explanation_find_letter_${letter}_wo_letter`
})
];
}
return [];
}
开发者ID:serlo-org,项目名称:serlo-abc,代码行数:16,代码来源:find-letter.ts
示例6: getExplanationVideos
private getExplanationVideos(letter: string) {
if (contains(letter, ['h', 'i', 'r'])) {
return [
this.createExercise(ExerciseTypes.InfoScreen, {
type: 'TutorialVideo',
video: `explanation_has_phoneme_${letter}_w_phoneme`
}),
this.createExercise(ExerciseTypes.InfoScreen, {
type: 'TutorialVideo',
video: `explanation_has_phoneme_${letter}_wo_phoneme`
})
];
}
return [];
}
开发者ID:serlo-org,项目名称:serlo-abc,代码行数:16,代码来源:has-phoneme.ts
示例7: createOptionsForSyllable
private createOptionsForSyllable(syllable: string) {
// find correct replacements (doubled vowels, diphtongs or knownVowels)
const replacementSet = this.createCorrectReplacementSet(syllable);
if (!replacementSet) {
return undefined;
}
// create a syllable option for each element in the replacement set
const result = map(
replacement =>
syllable.replace(
new RegExp(`(${join('|', replacementSet)})`, 'g'),
replacement
),
replacementSet
);
return contains(syllable, result) ? result : [...result, syllable];
}
开发者ID:serlo-org,项目名称:serlo-abc,代码行数:19,代码来源:connect-syllables.ts
示例8:
(ability: Ability, entity: Card): boolean =>
R.contains(ability, entity.abilities)
开发者ID:zernie,项目名称:typescript-redux-card-game,代码行数:2,代码来源:Card.ts
示例9: isItemCompleted
function isItemCompleted(item: ITodoItem): boolean {
return R.contains("completed", item.states);
}
开发者ID:ababup1192,项目名称:react-bacon-todomvc-typescript,代码行数:3,代码来源:todos.ts
示例10: curryN
const containsText = curryN(2, (textToSearch, list) => contains(list, textToSearch))
开发者ID:skellock,项目名称:apisauce,代码行数:1,代码来源:apisauce.ts
注:本文中的ramda.contains函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论