本文整理匯總了TypeScript中@ephox/katamari.Obj.mapToArray方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Obj.mapToArray方法的具體用法?TypeScript Obj.mapToArray怎麽用?TypeScript Obj.mapToArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@ephox/katamari.Obj
的用法示例。
在下文中一共展示了Obj.mapToArray方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: Error
const register = (editor: Editor): AutocompleterDatabase => {
const popups = editor.ui.registry.getAll().popups;
const dataset = Obj.map(popups, (popup) => {
return InlineContent.createAutocompleter(popup).fold(
(err) => {
throw new Error(ValueSchema.formatError(err));
},
(x) => x
);
});
const triggerChars = Unique.stringArray(
Obj.mapToArray(dataset, (v) => v.ch)
);
const datasetValues = Obj.values(dataset);
const lookupByChar = (ch: string): InlineContent.Autocompleter[] => {
return Arr.filter(datasetValues, (dv) => dv.ch === ch);
};
return {
dataset,
triggerChars,
lookupByChar
};
};
示例2:
const sAssertDialogContents = (expected: Record<string, any>) => {
const steps = [sWaitForUi('Wait for dialog to appear', 'div[role="dialog"]')];
Obj.mapToArray(selectors, (value, key) => {
if (Obj.has(expected, key)) {
steps.push(sAssertInputValue(key, value, expected[key]));
}
});
return GeneralSteps.sequence(steps);
};
示例3:
const sSetTabInputValues = (data, tabSelectors) => {
const steps = [];
Obj.mapToArray(tabSelectors, (value, key) => {
if (Obj.has(data, key)) {
steps.push(sSetInputValue(key, tabSelectors[key], data[key]));
}
});
return GeneralSteps.sequence(steps);
};
示例4: cSetFieldValue
const cSetTabFieldValues = (data, tabSelectors) => {
const chains = Arr.flatten(Obj.mapToArray(tabSelectors, (value, key): Chain<any, any>[] => {
if (Obj.has(data, key)) {
const newValue = typeof data[key] === 'object' ? data[key].value : data[key];
return [ cSetFieldValue(tabSelectors[key], newValue) ];
} else if (Obj.has(data, 'dimensions') && Obj.has(data.dimensions, key)) {
return [ cSetFieldValue(tabSelectors[key], data.dimensions[key]) ];
} else {
return [];
}
}));
return Chain.fromChains(chains);
};