本文整理汇总了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(
//.........这里部分代码省略.........
示例2: any
const anyPrivate = (hints: CacheControlHintsFormat): boolean => compose<CacheControlHintsFormat, MaybeCacheScope[], boolean>(
any(equals('PRIVATE')) as any,
pluck('scope')
)(hints)
示例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
}
示例4:
export const anyTaunts = (minions: MinionContainer) =>
R.any(
R.propSatisfies(R.contains(Ability.Taunt), 'abilities'),
R.values(minions)
);
示例5:
const isSchemaCacheable = (schemaMetaData: SchemaMetaData) => !any(scalar => schemaMetaData[scalar], shouldNotCacheWhenSchemaHas)
示例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[];
}
示例7: any
const hasErrorForPathName = (pathName: string, graphQLErrors?: any[]) => {
return graphQLErrors && any(propEq('pathName', pathName), graphQLErrors) || false
}