本文整理汇总了TypeScript中ramda.equals函数的典型用法代码示例。如果您正苦于以下问题:TypeScript equals函数的具体用法?TypeScript equals怎么用?TypeScript equals使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了equals函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: any
const anySegment = (hints: CacheControlHintsFormat): boolean => compose<CacheControlHintsFormat, MaybeCacheScope[], boolean>(
any(equals('SEGMENT')) as any,
pluck('scope')
)(hints)
示例2: equals
const isStrike = rolls => equals(10, head(rolls));
示例3: solve
import * as R from 'ramda';
const isEven = R.pipe(R.modulo(R.__, 2), R.equals(0));
function solve(
maxValue: number,
acc: number = 0,
[x, y]: [number, number] = [0, 1]
): number {
if (x > maxValue) { return acc; }
return isEven(x) ?
solve(maxValue, acc + x, [y, x + y]) :
solve(maxValue, acc, [y, x + y]);
}
console.log(solve(4000000));
示例4: all
const IPS: SearchField = 'ips';
const TYPE: SearchField = 'type';
const substitutions = {
tag: TAGS,
group: TAGS,
name: LABEL,
title: LABEL,
ip: IPS,
is: TYPE
};
return substitutions[key] || key;
};
// Returns true if all values in array are true
export const areAllTrue = all(equals(true));
// Returns true if at least ONE value in array is true
export const areAnyTrue = any(equals(true));
// This type is used by 'logic-query-parser
export type ValueType = 'and' | 'or' | 'string';
// This interface is used by 'logic-query-parser
export interface QueryJSON {
type: ValueType;
value?: string;
values?: QueryJSON[];
}
示例5:
(acc, key) =>
R.cond([
[R.equals('options'), R.always(acc)],
[R.equals('get'), key => R.concat(acc, [key, 'head'])],
[R.T, R.concat(acc)]
])(key),
示例6: buildParameter
const getChildValidators = (type, values) =>
R.equals(type, 'array') && Array.isArray(values) && values.length
? ['items', values.map(value => buildParameter(joi, value))]
: null;
示例7: accessMap
export function accessMap(ctx: Koa.Context): Function {
return getAccessMap([[equals('role:owner'), () => isCurrentUser(ctx)]])(ctx);
}
示例8: equals
uniqWith<ExtendedEvent, ExtendedEvent>((left, right) =>
equals(left.entity, right.entity)