• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript ramda.any函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript ramda.append函数代码示例发布时间:2022-05-25
下一篇:
TypeScript ramda.always函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap