本文整理匯總了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)