本文整理汇总了TypeScript中lodash.get函数的典型用法代码示例。如果您正苦于以下问题:TypeScript get函数的具体用法?TypeScript get怎么用?TypeScript get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1:
.map(data => _.get(data, 'earnings'))
开发者ID:ansteh,项目名称:ansteh.github.io,代码行数:1,代码来源:stock.service.ts
示例2: get
export const getView = (state: AppState, id: string): View => {
return get(state, `views.views.${id}.view`)
}
开发者ID:sebito91,项目名称:influxdb,代码行数:3,代码来源:index.ts
示例3: addFunctionParameter
addFunctionParameter(func, value) {
if (func.params.length >= func.def.params.length && !_.get(_.last(func.def.params), 'multiple', false)) {
throw { message: 'too many parameters for function ' + func.def.name };
}
func.params.push(value);
}
开发者ID:grafana,项目名称:grafana,代码行数:6,代码来源:graphite_query.ts
示例4: return
return (doc: SavedObjectDoc) =>
_.set(doc, path, _.isFunction(value) ? value(_.get(doc, path)) : value) as SavedObjectDoc;
开发者ID:gingerwizard,项目名称:kibana,代码行数:2,代码来源:document_migrator.test.ts
示例5: get
objPaths.forEach(path => {
const id = get(this, path);
if (id) {
ids.push(id._id || id);
}
});
开发者ID:freezy,项目名称:node-vpdb,代码行数:6,代码来源:file.reference.plugin.ts
示例6:
circular.forEach(c => {
const ref = _.get(json, c.circuralTargetPath)
_.set(json, c.pathToObj, ref)
})
开发者ID:darekf77,项目名称:ng2-rest,代码行数:4,代码来源:mapping.ts
示例7:
const addFilter = (state: LogsState, action: AddFilterAction): LogsState => {
const {filter} = action.payload
return {...state, filters: [filter, ..._.get(state, 'filters', [])]}
}
开发者ID:viccom,项目名称:influxdb,代码行数:5,代码来源:index.ts
示例8: getMonitorChartsData
/**
* Fetches data used to populate monitor charts
* @param request Kibana request
* @param monitorId ID value for the selected monitor
* @param dateRangeStart timestamp bounds
* @param dateRangeEnd timestamp bounds
*/
public async getMonitorChartsData(
request: any,
monitorId: string,
dateRangeStart: string,
dateRangeEnd: string
): Promise<MonitorChart> {
const params = {
index: INDEX_NAMES.HEARTBEAT,
body: {
query: {
bool: {
filter: [
{ range: { '@timestamp': { gte: dateRangeStart, lte: dateRangeEnd } } },
{ term: { 'monitor.id': monitorId } },
],
},
},
size: 0,
aggs: {
timeseries: {
auto_date_histogram: {
field: '@timestamp',
buckets: 25,
},
aggs: {
status: { terms: { field: 'monitor.status', size: 2, shard_size: 2 } },
duration: { stats: { field: 'monitor.duration.us' } },
},
},
},
},
};
const result = await this.database.search(request, params);
const buckets = dropLatestBucket(get(result, 'aggregations.timeseries.buckets', []));
/**
* The code below is responsible for formatting the aggregation data we fetched above in a way
* that the chart components used by the client understands.
* There are five required values. Two are lists of points that conform to a simple (x,y) structure.
*
* The third list is for an area chart expressing a range, and it requires an (x,y,y0) structure,
* where y0 is the min value for the point and y is the max.
*
* Additionally, we supply the maximum value for duration and status, so the corresponding charts know
* what the domain size should be.
*/
const monitorChartsData: MonitorChart = {
durationArea: [],
durationLine: [],
status: [],
durationMaxValue: 0,
statusMaxCount: 0,
};
buckets.forEach(bucket => {
const x = get(bucket, 'key');
const docCount = get(bucket, 'doc_count', 0);
// update the maximum value for each point
monitorChartsData.statusMaxCount = Math.max(docCount, monitorChartsData.statusMaxCount);
monitorChartsData.durationMaxValue = Math.max(
monitorChartsData.durationMaxValue,
get(bucket, 'duration.max', 0)
);
// these points express a range that will be displayed as an area chart
monitorChartsData.durationArea.push({
x,
yMin: get(bucket, 'duration.min', null),
yMax: get(bucket, 'duration.max', null),
});
monitorChartsData.durationLine.push({ x, y: get(bucket, 'duration.avg', null) });
monitorChartsData.status.push(
formatStatusBuckets(x, get(bucket, 'status.buckets', []), docCount)
);
});
return monitorChartsData;
}
开发者ID:njd5475,项目名称:kibana,代码行数:85,代码来源:elasticsearch_monitors_adapter.ts
示例9: parse
$("[style]").each((idx, elem) => {
const root = parse(_.get(elem.attribs, "style"));
const styles = pickDeclToStyleObject(root.nodes as Declaration[]);
appendStyleProps(elem, styles);
});
开发者ID:morlay,项目名称:simplify-svg,代码行数:6,代码来源:convertStyleToAttrs.ts
示例10: getFilterBar
/**
* Fetch options for the filter bar.
* @param request Kibana request object
* @param dateRangeStart timestamp bounds
* @param dateRangeEnd timestamp bounds
*/
public async getFilterBar(
request: any,
dateRangeStart: string,
dateRangeEnd: string
): Promise<FilterBar> {
const params = {
index: INDEX_NAMES.HEARTBEAT,
body: {
_source: ['monitor.id', 'monitor.type', 'url.full', 'url.port', 'monitor.name'],
size: 1000,
query: {
range: {
'@timestamp': {
gte: dateRangeStart,
lte: dateRangeEnd,
},
},
},
collapse: {
field: 'monitor.id',
},
sort: {
'@timestamp': 'desc',
},
},
};
const result = await this.database.search(request, params);
const ids: MonitorKey[] = [];
const ports = new Set<number>();
const types = new Set<string>();
const names = new Set<string>();
const hits = get(result, 'hits.hits', []);
hits.forEach((hit: any) => {
const key: string = get(hit, '_source.monitor.id');
const url: string | null = get(hit, '_source.url.full', null);
const port: number | undefined = get(hit, '_source.url.port', undefined);
const type: string | undefined = get(hit, '_source.monitor.type', undefined);
const name: string | null = get(hit, '_source.monitor.name', null);
if (key) {
ids.push({ key, url });
}
if (port) {
ports.add(port);
}
if (type) {
types.add(type);
}
if (name) {
names.add(name);
}
});
return {
ids,
ports: Array.from(ports),
schemes: Array.from(types),
names: Array.from(names),
statuses: ['up', 'down'],
};
}
开发者ID:njd5475,项目名称:kibana,代码行数:68,代码来源:elasticsearch_monitors_adapter.ts
注:本文中的lodash.get函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论