How to use the @remirror/core-helpers.bool function in @remirror/core-helpers

To help you get started, we’ve selected a few @remirror/core-helpers examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ifiokjr / remirror / @remirror / core / src / extension-manager.ts View on Github external
.forEach(attrs => {
        combinedAttributes = {
          ...combinedAttributes,
          ...attrs,
          class: (combinedAttributes.class ?? '') + (bool(attrs.class) ? attrs.class : '') || '',
        };
      });
github ifiokjr / remirror / @remirror / ui / src / ui-provider.tsx View on Github external
const hasParent = (
  theme: RemirrorThemeContextType,
): theme is RemirrorThemeContextType & { parent: RemirrorTheme } => bool(theme.parent);
github ifiokjr / remirror / @remirror / core-utils / src / dom-utils.ts View on Github external
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);
};
github ifiokjr / remirror / packages / jest-prosemirror / src / jest-prosemirror-matchers.ts View on Github external
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) };
    }
  },
github ifiokjr / remirror / packages / prosemirror-suggest / src / suggest-predicates.ts View on Github external
export const isChange = (compare: Partial): compare is CompareMatchParams =>
  bool(compare.prev && compare.next && compare.prev.queryText.full !== compare.next.queryText.full);
github ifiokjr / remirror / packages / prosemirror-suggest / src / suggest-predicates.ts View on Github external
export const isExit = (compare: Partial): compare is Pick =>
  bool(compare.prev && !compare.next);
github ifiokjr / remirror / @remirror / core-utils / src / environment.ts View on Github external
get isBrowser(): boolean {
    return bool(
      typeof window !== 'undefined' &&
        typeof window.document !== 'undefined' &&
        window.navigator &&
        window.navigator.userAgent,
    );
  },
github ifiokjr / remirror / packages / jest-prosemirror / src / jest-prosemirror-matchers.ts View on Github external
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) };
    }
  },