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