本文整理匯總了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();
}