Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
predicate: attrs => bool(attrs && attrs.colspan === 2),
});
.forEach(attrs => {
combinedAttributes = {
...combinedAttributes,
...attrs,
class: (combinedAttributes.class ?? '') + (bool(attrs.class) ? attrs.class : '') || '',
};
});
const hasParent = (
theme: RemirrorThemeContextType,
): theme is RemirrorThemeContextType & { parent: RemirrorTheme } => bool(theme.parent);
export const isMarkActive = ({ state, type, from, to }: IsMarkActiveParams) => {
const { selection, doc, storedMarks } = state;
const { $from, empty } = selection;
if (from && to) {
try {
return Math.max(from, to) < doc.nodeSize && doc.rangeHasMark(from, to, type);
} catch {
return false;
}
}
if (empty) {
return bool(type.isInSet(storedMarks ?? $from.marks()));
}
return doc.rangeHasMark(selection.from, selection.to, type);
};
toTransformNode(this: jest.MatcherUtils, command: CommandFunction, { from, to }: CommandTransformation) {
if (typeof command !== 'function') {
return {
message: () => `Please specify a valid command`,
pass: false,
};
}
if (!bool(from)) {
return {
message: () => `Please specify the 'from' node which this command: ${command.name} should transform`,
pass: false,
};
}
const expected = to ? to : from;
const shouldChange = bool(to);
const { pass, taggedDoc: actual } = apply(from, command, to);
const properties = { actual, expected, name: 'toTransformNode' };
if (pass) {
return { ...properties, pass, message: transformsNodePassMessage(actual, expected, shouldChange) };
} else {
return { ...properties, pass, message: transformsNodeFailMessage(actual, expected, shouldChange) };
}
},
export const isChange = (compare: Partial): compare is CompareMatchParams =>
bool(compare.prev && compare.next && compare.prev.queryText.full !== compare.next.queryText.full);
export const isExit = (compare: Partial): compare is Pick =>
bool(compare.prev && !compare.next);
get isBrowser(): boolean {
return bool(
typeof window !== 'undefined' &&
typeof window.document !== 'undefined' &&
window.navigator &&
window.navigator.userAgent,
);
},
toTransformNode(this: jest.MatcherUtils, command: CommandFunction, { from, to }: CommandTransformation) {
if (typeof command !== 'function') {
return {
message: () => `Please specify a valid command`,
pass: false,
};
}
if (!bool(from)) {
return {
message: () => `Please specify the 'from' node which this command: ${command.name} should transform`,
pass: false,
};
}
const expected = to ? to : from;
const shouldChange = bool(to);
const { pass, taggedDoc: actual } = apply(from, command, to);
const properties = { actual, expected, name: 'toTransformNode' };
if (pass) {
return { ...properties, pass, message: transformsNodePassMessage(actual, expected, shouldChange) };
} else {
return { ...properties, pass, message: transformsNodeFailMessage(actual, expected, shouldChange) };
}
},