當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript ramda.equals函數代碼示例

本文整理匯總了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)
開發者ID:vtex,項目名稱:apps-client-node,代碼行數:4,代碼來源:cacheControl.ts

示例2: equals

const isStrike = rolls => equals(10, head(rolls));
開發者ID:sprengerjo,項目名稱:katas_js,代碼行數:1,代碼來源:bowling_score_calculator.ts

示例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));
開發者ID:kellyi,項目名稱:katas,代碼行數:17,代碼來源:ts_euler2.ts

示例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[];
}
開發者ID:linode,項目名稱:manager,代碼行數:30,代碼來源:refinedSearch.ts

示例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),
開發者ID:benjambles,項目名稱:my-own-world,代碼行數:6,代碼來源:index.ts

示例6: buildParameter

 const getChildValidators = (type, values) =>
     R.equals(type, 'array') && Array.isArray(values) && values.length
         ? ['items', values.map(value => buildParameter(joi, value))]
         : null;
開發者ID:benjambles,項目名稱:my-own-world,代碼行數:4,代碼來源:build-joi-spec.ts

示例7: accessMap

export function accessMap(ctx: Koa.Context): Function {
    return getAccessMap([[equals('role:owner'), () => isCurrentUser(ctx)]])(ctx);
}
開發者ID:benjambles,項目名稱:my-own-world,代碼行數:3,代碼來源:index.ts

示例8: equals

 uniqWith<ExtendedEvent, ExtendedEvent>((left, right) =>
   equals(left.entity, right.entity)
開發者ID:linode,項目名稱:manager,代碼行數:2,代碼來源:combineEventsMiddleware.ts


注:本文中的ramda.equals函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。