本文整理汇总了TypeScript中lodash.forIn函数的典型用法代码示例。如果您正苦于以下问题:TypeScript forIn函数的具体用法?TypeScript forIn怎么用?TypeScript forIn使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了forIn函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should test if all messages methods are defined', () => {
_.forIn(service.messages, (value, key) => {
expect(value.descr({})).toBeTruthy();
expect(value.success({})).toBeTruthy();
expect(value.error({})).toBeTruthy();
});
});
示例2: handleQueries
function handleQueries(component: any) {
forIn(queries(component), (options, queryName: string) => {
if (!equalVariablesOf(queryName, options.variables)) {
createQuery(component, queryName, options);
}
});
}
示例3: handleQueries
function handleQueries(component: any) {
forIn(queries(component), ({ query, variables }, queryName: string) => {
if (!equalVariablesOf(queryName, variables)) {
createQuery(component, queryName, { query, variables });
}
});
}
示例4: ngOnInit
ngOnInit() {
const fg = {};
this.helpText = this.iscsiService.targetAdvancedSettings;
_.forIn(this.target_default_controls, (value, key) => {
fg[key] = new FormControl(this.target_controls.value[key]);
});
this.settingsForm = new CdFormGroup(fg);
}
示例5: test
function test(params, wanted) {
const r = compute(params.attrs, params.prev_defaults, params.v);
//console.log('attrs:' + JSON.stringify(r.attrs));
//console.log('v:' + JSON.stringify(params.v));
if (wanted.attrNames) assert.equal(Object.keys(r.attrs).sort().join(' '), wanted.attrNames);
forIn(wanted.subAttrs || {}, (opts, k) => assert.deepEqual(r.attrs[k], opts));
if (wanted.v) assert.deepEqual(params.v, wanted.v);
if (wanted.prev_defaults) assert.deepEqual(r.prev_defaults, wanted.prev_defaults);
params.prev_defaults = r.prev_defaults;
}
示例6: exit
cluster.on("exit", (_worker, code, _signal) => {
if (code && code !== 0) {
// Kill workers and exit if any worker dies
_.forIn(cluster.workers, w => {
if (w) {
w.kill();
}
});
exit(code);
}
});
示例7: save
save() {
const settings = {};
_.forIn(this.settingsForm.controls, (control, key) => {
if (!(control.value === '' || control.value === null)) {
settings[key] = control.value;
}
});
this.target_controls.setValue(settings);
this.modalRef.hide();
}
示例8: ngOnInit
ngOnInit() {
const fg = {};
const currentSettings = this.imagesSettings[this.image];
this.helpText = this.iscsiService.imageAdvancedSettings;
_.forIn(this.disk_default_controls, (value, key) => {
fg[key] = new FormControl(currentSettings[key]);
});
this.settingsForm = new CdFormGroup(fg);
}
示例9: getRequestLookupExts
function getRequestLookupExts (requestType: RequestType): string[] {
let exts: string[] = []
_.forIn(LangTypes, (value, key) => {
if (requestType === value.requestType) {
exts.push(key)
}
})
return exts
}
示例10: save
save() {
const settings = {};
_.forIn(this.settingsForm.value, (value, key) => {
if (!(value === '' || value === null)) {
settings[key] = value;
}
});
this.imagesSettings[this.image] = settings;
this.imagesSettings = { ...this.imagesSettings };
this.modalRef.hide();
}