本文整理汇总了TypeScript中lodash.has函数的典型用法代码示例。如果您正苦于以下问题:TypeScript has函数的具体用法?TypeScript has怎么用?TypeScript has使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了has函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: return
let funcs = _.filter(analyzeStack, (as) => {
return (_.has(as, 'args'));
});
示例2:
var dimensionKey = _.findKey(target.dimensions, v => {
return templateSrv.variableExists(v) && !_.has(scopedVars, templateSrv.getVariableName(v));
});
示例3:
return player => _.has(player, 'nickname') && re.test(player.nickname);
示例4: isEvent
static isEvent(proto: any): proto is Event {
return _.has(proto, "context") && _.has(proto, "data");
}
示例5:
(uiData) => uiData && _.has(uiData, VERSION_DISMISSED_KEY),
示例6:
.reduce((acc: IInstanceCounts, instance: any) => {
if (has(instance, 'health.state')) {
acc[camelCase(instance.health.state)]++;
}
return acc;
}, {up: 0, down: 0, outOfService: 0, succeeded: 0, failed: 0, starting: 0, unknown: 0}).value();
示例7: function
_.each(tavoitteet, function(tavoite) {
if (!tavoite.pakollinen && tavoite._esitieto && _.has(groups.grouped, tavoite._esitieto)) {
groups.grouped[tavoite._esitieto].push(tavoite);
processed.push(tavoite);
}
});
示例8: createPlayer
export default function createPlayer(manifestEntry: ManifestEntry, sourceEntry: SourceEntry): Player {
let {
faction, extraData
} = manifestEntry;
let {
oid,
name,
nickname,
level,
errors,
extraData: sourceExtraData
} = sourceEntry;
const player: Player = {
oid,
faction,
level,
nickname,
name,
anomaly: [],
community: [],
event: [],
sources: [],
errors,
};
if (_.has(sourceExtraData, 'faction')) {
player.faction = parseFaction(sourceExtraData['faction']);
sourceExtraData = _.omit<ExtraData, ExtraData>(sourceExtraData, 'faction');
}
let extra = _.merge({} as ExtraData, extraData, sourceExtraData);
const community = extractCommunityOrEvent('community', extra);
if (community != null) {
player.community.push(community);
}
const event = extractCommunityOrEvent('event', extra);
if (event != null) {
player.event.push(event);
}
if (_.has(extra, 'anomaly')) {
if (isValidAnomaly(extra['anomaly'])) {
player.anomaly.push(parseAnomaly(extra['anomaly']));
} else {
player.errors.push(`Unknown anomaly: "${extra['anomaly']}"`);
}
delete extra['anomaly'];
}
if (!_.isEmpty(extra)) {
player.extra = mapExtra(extra);
}
return player;
}
示例9:
export function isLeaf<T>(t: TreeNode<T>): boolean {
return !_.has(t, "children");
}
示例10: Error
selectionSet.selections.forEach((selection) => {
if (selection.kind !== 'Field') {
throw new Error('Only fields supported so far, not fragments.');
}
const field = selection as Field;
const storeFieldKey = storeKeyNameFromField(field, variables);
const resultFieldKey = resultKeyNameFromField(field);
if (! has(storeObj, storeFieldKey)) {
if (throwOnMissingField) {
throw new Error(`Can't find field ${storeFieldKey} on object ${storeObj}.`);
}
missingSelections.push(field);
return;
}
const storeValue = storeObj[storeFieldKey];
if (! field.selectionSet) {
result[resultFieldKey] = storeValue;
return;
}
if (isNull(storeValue)) {
// Basically any field in a GraphQL response can be null
result[resultFieldKey] = null;
return;
}
if (isArray(storeValue)) {
result[resultFieldKey] = storeValue.map((id) => {
const itemDiffResult = diffSelectionSetAgainstStore({
store,
throwOnMissingField,
rootId: id,
selectionSet: field.selectionSet,
variables,
});
itemDiffResult.missingSelectionSets.forEach(
itemSelectionSet => missingSelectionSets.push(itemSelectionSet));
return itemDiffResult.result;
});
return;
}
if (isString(storeValue)) {
const subObjDiffResult = diffSelectionSetAgainstStore({
store,
throwOnMissingField,
rootId: storeValue,
selectionSet: field.selectionSet,
variables,
});
// This is a nested query
subObjDiffResult.missingSelectionSets.forEach(
subObjSelectionSet => missingSelectionSets.push(subObjSelectionSet));
result[resultFieldKey] = subObjDiffResult.result;
return;
}
throw new Error('Unexpected number value in the store where the query had a subselection.');
});