本文整理汇总了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);
};