本文整理汇总了TypeScript中lodash.keysIn函数的典型用法代码示例。如果您正苦于以下问题:TypeScript keysIn函数的具体用法?TypeScript keysIn怎么用?TypeScript keysIn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了keysIn函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it("delete Widget", function () {
const store = Store.createEmpty({log: false});
store.dispatch(Widgets.addWidget("my-widget-type", {foo: "bar"}, 1, 2, 3, 4));
assert.equal(_.keysIn(store.getState().widgets).length, 1);
_.valuesIn(store.getState().widgets).forEach((widget: Widgets.IWidgetState) => {
store.dispatch(Widgets.deleteWidget(widget.id));
});
assert.equal(_.keysIn(store.getState().widgets).length, 0);
});
示例2: RegExp
return this._gnocchi_request(resource_search_req).then((result) => {
var re = new RegExp(metric_regex);
var metrics = {};
_.forEach(result, (resource) => {
_.forOwn(resource["metrics"], (id, name) => {
if (re.test(name)) {
metrics[id] = this._compute_label(user_label, resource, name, target.aggregator);
}
});
});
if (target.queryMode === "resource_search"){
/* RESOURCE SEARCH */
return this.$q.all(_.map(metrics, (label, id) => {
var measures_req = _.merge({}, default_measures_req);
measures_req.url = 'v1/metric/' + id + '/measures';
return this._retrieve_measures(label, measures_req,
target.draw_missing_datapoint_as_zero);
}));
} else {
/* RESOURCE AGGREGATION */
var measures_req = _.merge({}, default_measures_req);
measures_req.url = 'v1/aggregation/metric';
measures_req.params.metric = _.keysIn(metrics);
this.ReqAddAggregationOptions(measures_req, target);
// We don't pass draw_missing_datapoint_as_zero, this is done by fill
return this._retrieve_measures(user_label || "unlabeled", measures_req, false);
}
});
示例3: RegExp
return value.filter((obj)=>{
let keys = _.keysIn(obj);
let objString = JSON.stringify(obj).toLowerCase();
_.each(keys,(k)=>{
let re = new RegExp('"'+k.toLowerCase()+'"',"g");
objString = objString.replace(re,'');
});
return objString.indexOf(args.toLowerCase()) !== -1;
});
示例4: fieldMap
export function insertQuery<F> (v: Model<F> | IResourceObject) {
const id = v.id
if (!id) {
throw ErrIDRequired
}
const map = fieldMap(v, { id })
return SqlString.format(
`INSERT INTO ?? (??) VALUES (?);`,
[ tableName(v), _.keysIn(map), _.valuesIn(map) ]
)
}
示例5: process
public process(object: Object, propertyDescriptors?: Map<string, Object>): Object {
if (_.isEmpty(object)) {
return null;
}
let processed = new Map<string, any>(),
keys = _.keysIn(object),
value;
for (let property of keys) {
value = object[property];
let cleanupResult = this.cleanupValue(value);
var cleanedValue = cleanupResult.cleanedValue;
var hasValue = cleanupResult.hasValue;
if (hasValue) {
processed.set(property, cleanedValue);
}
}
return processed.size > 0 ? immutable.Map(processed).toJS() : null;
}