本文整理汇总了TypeScript中ramda.has函数的典型用法代码示例。如果您正苦于以下问题:TypeScript has函数的具体用法?TypeScript has怎么用?TypeScript has使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了has函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: castModelKey
export const hiddenComponentDecorator = ({
modelName,
fields,
}: {
modelName: string;
fields: Fields;
}): { modelName; fields: Fields & WithHidden } => {
const TAG = '[hiddenComponentDecorator]';
logger.log(TAG, { fields });
let wrappedFields = R.omit([castModelKey('createdAt'), castModelKey('updatedAt')])(fields);
if (R.has('id', wrappedFields)) {
const hidden = R.isNil(wrappedFields.id.value);
wrappedFields = R.mergeDeepRight(wrappedFields, { id: { options: { hidden } } });
}
const positions = R.filter(R.pathEq(['options', 'type'], 'SortPosition'))(wrappedFields);
if (!R.isEmpty(positions)) {
const hiddenPositions = R.map(position => ({
...position,
options: { hidden: true },
}))(positions);
wrappedFields = R.mergeDeepRight(wrappedFields, { ...hiddenPositions });
}
logger.log(TAG, 'wrappedFields', { wrappedFields }, diff(fields, wrappedFields));
return { modelName, fields: wrappedFields };
};
开发者ID:danielwii,项目名称:asuna-admin,代码行数:28,代码来源:index.ts
示例2: has
const isReactNativeEvent = (value: any) =>
typeof value !== 'undefined' && value !== null && has("nativeEvent", value) && has("target", value) && has("type", value)
开发者ID:nick121212,项目名称:reactotron,代码行数:2,代码来源:reactotron-mst.ts
示例3: getArrObjFieldByFieldValue
getArrObjFieldByFieldValue(getField, findField, findFieldValue, list) {
return R.prop(getField, this.getArrObjByFieldValue(findField, findFieldValue, list))
},
//flattenObjArr ::
flattenObjArr(filedA, filedB, list) {
return R.compose(R.pluck(filedB), R.flatten, R.pluck(filedA))(list)
},
flattenObjArrSum(filedA, filedB, list) {
return R.compose(R.sum, R.pluck(filedB), R.flatten, R.pluck(filedA))(list)
},
//// {} ////
// has :: s → {s: x} → Boolean
has(field, obj) {
return R.has(field)(obj)
},
// keys :: {k: v} → [k]
keys(obj) {
return R.keys(obj)
},
// values :: {k: v} → [v]
values(obj) {
return R.values(obj)
},
// prop :: s → {s: a} → a | Undefined
prop(obj) {
return R.prop(obj)
},
// propOr :: a → String → Object → a
开发者ID:stefaniepei,项目名称:react-redux-scaffold,代码行数:31,代码来源:ramda.ts
示例4: 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
示例5: has
const isReactNativeEvent = (value: any) =>
value !== null && has("nativeEvent", value) && has("target", value) && has("type", value)
开发者ID:chenrui2014,项目名称:reactotron,代码行数:2,代码来源:reactotron-mst.ts
注:本文中的ramda.has函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论