How to use the @remirror/core-helpers.isPlainObject 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 / ui / src / ui-hsl.ts View on Github external
const isHSLObject = (value: unknown): value is HSLObject =>
  bool(isPlainObject(value) && value.h && value.s && value.l);
github ifiokjr / remirror / @remirror / ui / src / ui-utils.ts View on Github external
export const hasThemeProp = (val: unknown): val is ThemeParams =>
  isPlainObject(val) && isPlainObject(val.theme);
github ifiokjr / remirror / @remirror / react-node-view / src / react-node-view.tsx View on Github external
public setDomAttrs(node: ProsemirrorNode, element: HTMLElement) {
    const { toDOM } = this.node.type.spec;
    if (toDOM) {
      const domSpec = toDOM(node);

      if (isString(domSpec) || isDOMNode(domSpec)) {
        return;
      }

      const attrs = domSpec[1];

      if (isPlainObject(attrs)) {
        keys(attrs).forEach(attr => {
          element.setAttribute(attr, String(attrs[attr]));
        });

        return;
      }
    }

    keys(node.attrs).forEach(attr => {
      element.setAttribute(attr, node.attrs[attr]);
    });
  }
github ifiokjr / remirror / @remirror / ui / src / ui-utils.ts View on Github external
styles.map(style =>
      isArray(style)
        ? sx(...style)(theme)
        : isFunction(style)
        ? css(style(theme))(theme)
        : isSerializedStyle(style)
        ? style
        : isPlainObject(style)
        ? css(style as WithVariants)(theme)
        : style,
    ),
github ifiokjr / remirror / @remirror / ui-menus / src / menu-bar.tsx View on Github external
}

      case 'dropdown': {
        const { type, ...rest } = item;
        return ;
      }

      case 'button': {
        const { type, ...rest } = item;
        return <button>;
      }

      default:
        throw new Error(
          `Invalid configuration passed into the MenuTree: ${
            isPlainObject(item) ? JSON.stringify(item, null, 2) : item
          }`,
        );
    }
  });
</button>
github ifiokjr / remirror / @remirror / ui / src / ui-utils.ts View on Github external
export const isSerializedStyle = (val: unknown): val is SerializedStyles =>
  isPlainObject(val) && isString(val.name) && isString(val.styles);