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


TypeScript ramda.any函數代碼示例

本文整理匯總了TypeScript中ramda.any函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript any函數的具體用法?TypeScript any怎麽用?TypeScript any使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了any函數的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: loadObject

export function loadObject(object: any, defaults = DEFAULTS): Config {
  let config = R.clone(defaults);

  if (object.hasOwnProperty('client')) {
    let client = object.client;
    ConfigTypeError.assert('client', 'object', client);

    setKey(config.client, ['client', 'name'], 'string', client);
    setKey(config.client, ['client', 'config'], 'object', client);
    setKey(config.client, ['client', 'journalTable'], 'string', client);
  }

  if (object.hasOwnProperty('files')) {
    ConfigTypeError.assert('files', 'object', object.files);

    setKey(config.files, ['files', 'directory'], 'string', object.files);
  }

  setEnumKey(config, ['command'], Command, object);

  if (object.hasOwnProperty('commands')) {
    let commands = object.commands;
    ConfigTypeError.assert('commands', 'object', commands);

    if (commands.hasOwnProperty('migrations')) {
      let migrations = commands.migrations;
      ConfigTypeError.assert('commands.migrations', 'object', migrations);

      setKey(
        config.commands.migrations,
        ['commands', 'migrations', 'long'],
        'boolean',
        migrations
      );
      setKey(
        config.commands.migrations,
        ['commands', 'migrations', 'id'],
        'string',
        migrations
      );
    }

    if (commands.hasOwnProperty('status')) {
      let status = commands.status;
      ConfigTypeError.assert('commands.status', 'object', status);

      setKey(
        config.commands.status,
        ['commands', 'status', 'id'],
        'string',
        status
      );
    }

    if (commands.hasOwnProperty('journal')) {
      let journal = commands.journal;
      ConfigTypeError.assert('commands.journal', 'object', journal);

      setKey(
        config.commands.journal,
        ['commands', 'journal', 'id'],
        'string',
        journal
      );
    }

    if (commands.hasOwnProperty('create')) {
      let create = commands.create;
      ConfigTypeError.assert('commands.create', 'object', create);

      setKey(
        config.commands.create,
        ['commands', 'create', 'generateID'],
        'function',
        create
      );
      setKey(
        config.commands.create,
        ['commands', 'create', 'split'],
        'boolean',
        create
      );
      setKey(
        config.commands.create,
        ['commands', 'create', 'name'],
        'string',
        create
      );

      if (create.hasOwnProperty('templatePaths')) {
        let templatePaths = create.templatePaths;
        ConfigTypeError.assert('commands.create.templatePaths', 'object', templatePaths);

        setKey(
          config.commands.create.templatePaths,
          ['commands', 'create', 'templatePaths', 'combined'],
          'string',
          templatePaths
        );
        setKey(
//.........這裏部分代碼省略.........
開發者ID:programble,項目名稱:careen,代碼行數:101,代碼來源:load.ts

示例2: any

const anyPrivate = (hints: CacheControlHintsFormat): boolean => compose<CacheControlHintsFormat, MaybeCacheScope[], boolean>(
  any(equals('PRIVATE')) as any,
  pluck('scope')
)(hints)
開發者ID:vtex,項目名稱:apps-client-node,代碼行數:4,代碼來源:cacheControl.ts

示例3: pluck

import { GraphQLServiceContext } from '../typings'
import { toArray } from '../utils/array'
import { generatePathName } from '../utils/pathname'

const CACHE_CONTROL_HEADER = 'cache-control'
const META_HEADER = 'x-vtex-meta'
const ETAG_HEADER = 'etag'
const TWO_SECONDS_S = 2
const sender = process.env.VTEX_APP_ID

const getSplunkQuery = (account: string, workspace: string) =>
  `Try this query at Splunk to retrieve error log: 'index=colossus key=log_error sender="${sender}" account=${account} workspace=${workspace}'`

const parseMessage = pluck('message')

const arrayHasError = any(has('errors'))

const filterErrors = filter(has('errors')) as (x: ReadonlyArray<{}>) => ReadonlyArray<{}>

const chainErrors = chain(prop<any, any>('errors'))

const hasError = compose(arrayHasError, toArray)

const parseError = compose(chainErrors, filterErrors, toArray)

const parseErrorResponse = (response: any) => {
  if (hasError(response)) {
    return parseError(response)
  }
  return null
}
開發者ID:vtex,項目名稱:apps-client-node,代碼行數:31,代碼來源:error.ts

示例4:

export const anyTaunts = (minions: MinionContainer) =>
  R.any(
    R.propSatisfies(R.contains(Ability.Taunt), 'abilities'),
    R.values(minions)
  );
開發者ID:zernie,項目名稱:typescript-redux-card-game,代碼行數:5,代碼來源:Minion.ts

示例5:

const isSchemaCacheable = (schemaMetaData: SchemaMetaData) => !any(scalar => schemaMetaData[scalar], shouldNotCacheWhenSchemaHas)
開發者ID:vtex,項目名稱:apps-client-node,代碼行數:1,代碼來源:index.ts

示例6: 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

示例7: any

const hasErrorForPathName = (pathName: string, graphQLErrors?: any[]) => {
  return graphQLErrors && any(propEq('pathName', pathName), graphQLErrors) || false
}
開發者ID:vtex,項目名稱:apps-client-node,代碼行數:3,代碼來源:timings.ts


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