Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const registerFormats = (customFormats: {name: string, format: StyleFormat}[]) => {
Arr.each(customFormats, (fmt) => {
// Only register the custom format with the editor, if it's not already registered
if (!editor.formatter.has(fmt.name)) {
editor.formatter.register(fmt.name, fmt.format);
}
});
};
const processElements = (elems) => {
Arr.each(elems, processElement);
};
const destroy = function () {
Arr.each(listeners, function (l) {
l.unbind();
});
};
const show = (editor: Editor, rootElm: Node) => {
const nodeList = Nodes.filterDescendants(SugarElement.fromDom(rootElm), Nodes.isMatch);
Arr.each(nodeList, (n) => {
const parent = n.dom().parentNode;
if (isWrappedNbsp(parent)) {
Class.add(SugarElement.fromDom(parent), Data.nbspClass);
} else {
const withSpans = Nodes.replaceWithSpans(editor.dom.encode(SugarNode.value(n)));
const div = editor.dom.create('div', null, withSpans);
let node: any;
while ((node = div.lastChild)) {
editor.dom.insertAfter(node, n.dom());
}
editor.dom.remove(n.dom());
}
});
};
Arr.each(matches, (match: FilterMatch) => {
Arr.each(match.filter.callbacks, (callback: ParserFilterCallback) => {
callback(match.nodes, match.filter.name, {});
});
});
};
const dlIndentation = (editor: Editor, indentation: Indentation, dlItems: Element[]) => {
if (indentation === Indentation.Indent) {
Arr.each(dlItems, indentDlItem);
} else {
Arr.each(dlItems, (item) => outdentDlItem(editor, item));
}
};
const filter = (nodeFilters: ParserFilter[], attributeFilters: ParserFilter[], node: Node): void => {
const matches = findMatchingNodes(nodeFilters, attributeFilters, node);
Arr.each(matches, (match: FilterMatch) => {
Arr.each(match.filter.callbacks, (callback: ParserFilterCallback) => {
callback(match.nodes, match.filter.name, {});
});
});
};
const morphToStatic = (component: AlloyComponent, config: DockingConfig): void => {
Arr.each([ 'left', 'top', 'position' ], (prop) => Css.remove(component.element(), prop));
config.onUndocked(component);
};
Arr.each(comparisonData, (items) => {
Arr.each(keys, (key) => {
Obj.each(items, (itemValue, itemKey) => {
const comparisonValue = baseData[key];
if (comparisonValue !== '' && key === itemKey) {
if (comparisonValue !== itemValue) {
baseData[key] = '';
}
}
});
});
});