本文整理汇总了TypeScript中@ephox/katamari.Arr.forall方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Arr.forall方法的具体用法?TypeScript Arr.forall怎么用?TypeScript Arr.forall使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/katamari.Arr
的用法示例。
在下文中一共展示了Arr.forall方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getIndentStyleName
const validateBlocks = (editor: Editor, blocks: Element[]) => {
return Arr.forall(blocks, (block) => {
const indentStyleName = getIndentStyleName(Settings.shouldIndentUseMargin(editor), block);
const intentValue = Css.getRaw(block, indentStyleName).map(parseIndentValue).getOr(0);
const contentEditable = editor.dom.getContentEditable(block.dom());
return contentEditable !== 'false' && intentValue > 0;
});
};
示例2: function
const unmergable = function (cell, selections) {
const hasSpan = function (elem) {
return (Attr.has(elem, 'rowspan') && parseInt(Attr.get(elem, 'rowspan'), 10) > 1) ||
(Attr.has(elem, 'colspan') && parseInt(Attr.get(elem, 'colspan'), 10) > 1);
};
const candidates = selection(cell, selections);
return candidates.length > 0 && Arr.forall(candidates, hasSpan) ? Option.some(candidates) : Option.none();
};
示例3: function
const isValidDataUriImage = function (imgElm: HTMLImageElement) {
if (Arr.forall(urlFilters, (filter) => filter(imgElm)) === false) {
return false;
}
if (imgElm.getAttribute('src').indexOf('data:') === 0) {
const dataImgFilter = Settings.getImagesDataImgFilter(editor);
return dataImgFilter(imgElm);
}
return true;
};
示例4: err
const formatOrCmd = <T> (name: string, onFormat: (formats: string[]) => T, onCommand: (cmd: string, value: any) => T): Result<T, PatternError> => {
if (pattern.format !== undefined) {
let formats: string[];
if (Type.isArray(pattern.format)) {
if (!Arr.forall(pattern.format, Type.isString)) {
return err(name + ' pattern has non-string items in the `format` array');
}
formats = pattern.format;
} else if (Type.isString(pattern.format)) {
formats = [pattern.format];
} else {
return err(name + ' pattern has non-string `format` parameter');
}
return Result.value(onFormat(formats));
} else if (pattern.cmd !== undefined) {
if (!Type.isString(pattern.cmd)) {
return err(name + ' pattern has non-string `cmd` parameter');
}
return Result.value(onCommand(pattern.cmd, pattern.value));
} else {
return err(name + ' pattern is missing both `format` and `cmd` parameters');
}
};
示例5:
const isArrayOf = (p: (a: any) => boolean) => (a: any) => Type.isArray(a) && Arr.forall(a, p);
示例6:
const isArrayOfUrl = (a: any): boolean => {
return Type.isArray(a) && a.length <= HISTORY_LENGTH && Arr.forall(a, isHttpUrl);
};
示例7:
const matchesSystemStack = (): boolean => {
// Split the fonts into an array and strip away any quotes
const fonts = fontFamily.toLowerCase().split(/['"]?\s*,\s*['"]?/);
return Arr.forall(systemStackFonts, (font) => fonts.indexOf(font.toLowerCase()) > -1);
};