本文整理汇总了TypeScript中ramda.is函数的典型用法代码示例。如果您正苦于以下问题:TypeScript is函数的具体用法?TypeScript is怎么用?TypeScript is使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: catch
const toJson = value => {
if (R.is(String, value) && value.length) {
try {
return JSON.parse(value);
} catch (e) {
logger.warn(TAG, e, { jsonFields });
return null;
}
}
if (R.is(Object, value)) {
return value;
}
return null;
};
开发者ID:danielwii,项目名称:asuna-admin,代码行数:14,代码来源:index.ts
示例2: map
map((key: string) => {
const keyMinusWildcard = slice(0, -2, key)
const value = dotPath(keyMinusWildcard, state)
if (is(Object, value) && !isNilOrEmpty(value)) {
return pipe(keys, map(key => `${keyMinusWildcard}.${key}`))(value)
}
return []
}) as any,
开发者ID:nick121212,项目名称:reactotron,代码行数:8,代码来源:reactotron-mst.ts
示例3:
const assignFields = R.forEach(n => {
if (R.is(Object, n)) {
const key = R.pipe(R.keys, R.head)(n);
const value = R.pipe(R.values, R.head)(n);
return result[key] = source[value];
}
return result[n] = source[n];
})(rules);
开发者ID:simbiosis-group,项目名称:ion2-helper,代码行数:8,代码来源:record-helper.ts
示例4:
R.map(field => {
// raw is the original value, if exists, means it's update request
if (field.value && !field.raw) {
const value = R.is(String, field.value) ? JSON.parse(field.value) : field.value;
return { ...field, value, raw: field.value };
}
return { ...field, value: R.path([current, 'value'])(fields), raw: field.value };
}),
开发者ID:danielwii,项目名称:asuna-admin,代码行数:8,代码来源:index.ts
示例5: dispatch
/**
* Dispatches a payload to all registered callbacks
* @param {object} payload Must contain an actionType property
*/
public dispatch(payload) {
if (R.is(Object, payload) && R.prop('actionType')) {
this._dispatcherObsv.onNext(payload);
} else {
throw new Error('payload must be an object with at least an actionType property');
}
}
开发者ID:webintensive,项目名称:angular-2-transition-utils,代码行数:13,代码来源:dispatcher.ts
示例6: curryN
export let forwardMessage = curryN(2, (options = {}, update: Update) => Request({
type: 'sink',
method: 'forwardMessage',
options: defaults(
{
from_chat_id: defaultTo(path(['message', 'chat', 'id'], update)),
message_id: defaultTo(path(['message', 'message_id'], update))
},
is(Number, options) ? {chat_id: options} : options)
}))
开发者ID:goodmind,项目名称:cycle-telegram,代码行数:10,代码来源:sinks.ts
示例7: is
apiResponse: (request, response, duration) => {
const ok =
response &&
response.status &&
is(Number, response.status) &&
response.status >= 200 &&
response.status <= 299
const important = !ok
reactotron.send("api.response", { request, response, duration }, important)
},
开发者ID:nick121212,项目名称:reactotron,代码行数:10,代码来源:api-response.ts
示例8:
this[actionType] = (_payload) => {
// Check to see if the payload is an object or not
let payload = R.is(Object, _payload) ? _payload : {};
// Attach action type to the payload
payload = R.merge(_payload, { actionType: actionType });
this.dispatcher.dispatch(payload);
// return payload for testing
return payload;
};
开发者ID:webintensive,项目名称:angular-2-transition-utils,代码行数:11,代码来源:actions.ts
示例9: path
const linearMatch = target => {
const value = path(modifierPath, target)
if (is(Boolean, value)) {
return value
}
if (isNil(value)) {
return false
}
return !isEmpty(value)
}
开发者ID:monstrs,项目名称:elementum,代码行数:13,代码来源:match.ts
注:本文中的ramda.is函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论