How to use the @remirror/core-helpers.isNumber 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-utils / src / dom-utils.ts View on Github external
export const isDOMNode = (domNode: unknown): domNode is Node =>
  isObject(Node)
    ? domNode instanceof Node
    : isObject(domNode) && isNumber(Cast(domNode).nodeType) && isString(Cast(domNode).nodeName);
github ifiokjr / remirror / packages / multishift / src / multishift-utils.ts View on Github external
export const isNode = (domNode: unknown): domNode is Node =>
  isObject(Node)
    ? domNode instanceof Node
    : isObject(domNode) && isNumber((domNode as any).nodeType) && isString((domNode as any).nodeName);
github ifiokjr / remirror / @remirror / ui / src / ui-hsl.ts View on Github external
public alpha(alpha?: number | string): HSL {
    return this.clone({ ...this.hsla, a: createValidAlpha(isNumber(alpha) ? `${alpha}%` : alpha) });
  }
github ifiokjr / remirror / @remirror / ui / src / ui-hsl.ts View on Github external
const isValidHue = (hue: unknown): hue is Hue => isNumber(hue) && hue <= 360 && hue >= 0;
const createValidHue = (value: number | string) => {
github ifiokjr / remirror / @remirror / core-utils / src / command-utils.ts View on Github external
}: RemoveMarkParams): CommandFunction => (state, dispatch) => {
  const { selection } = state;
  const tr = callMethod({ fn: startTransaction, defaultReturn: state.tr }, [state.tr, state]);
  let { from, to } = range ?? selection;

  if (expand) {
    ({ from, to } = range
      ? getMarkRange(state.doc.resolve(range.from), type) ||
        (isNumber(range.to) && getMarkRange(state.doc.resolve(range.to), type)) || { from, to }
      : selectionEmpty(state)
      ? getMarkRange(state.selection.$anchor, type) || { from, to }
      : { from, to });
  }

  tr.removeMark(from, isNumber(to) ? to : from, type);

  if (dispatch) {
    dispatch(callMethod({ fn: endTransaction, defaultReturn: tr }, [tr, state]));
  }

  return true;
};
github ifiokjr / remirror / @remirror / ui / src / ui-hsl.ts View on Github external
const isValidPercent = (percent: unknown): percent is Percent =>
  isNumber(percent) && percent <= 100 && percent >= 0;
github ifiokjr / remirror / packages / multishift / src / multishift-utils.ts View on Github external
export const isValidIndex = (index: number | undefined | null): index is number =>
  isNumber(index) && index > -1;
github ifiokjr / remirror / @remirror / core-utils / src / command-utils.ts View on Github external
}: RemoveMarkParams): CommandFunction => (state, dispatch) => {
  const { selection } = state;
  const tr = callMethod({ fn: startTransaction, defaultReturn: state.tr }, [state.tr, state]);
  let { from, to } = range ?? selection;

  if (expand) {
    ({ from, to } = range
      ? getMarkRange(state.doc.resolve(range.from), type) ||
        (isNumber(range.to) && getMarkRange(state.doc.resolve(range.to), type)) || { from, to }
      : selectionEmpty(state)
      ? getMarkRange(state.selection.$anchor, type) || { from, to }
      : { from, to });
  }

  tr.removeMark(from, isNumber(to) ? to : from, type);

  if (dispatch) {
    dispatch(callMethod({ fn: endTransaction, defaultReturn: tr }, [tr, state]));
  }

  return true;
};