How to use the @remirror/core-helpers.isArray 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 / packages / multishift / src / multishift-utils.ts View on Github external
return omit(changes, (value, key) => {
    if (isArray(value)) {
      if (key === 'selectedItems') {
        return (
          value.length !== state.selectedItems.length ||
          (value as GItem[]).some((item, index) => getItemId(item) !== getItemId(state.selectedItems[index]))
        );
      }

      if (key === 'highlightedIndexes') {
        return (
          value.length !== state.highlightedIndexes.length ||
          (value as number[]).some((val, index) => val !== state.highlightedIndexes[index])
        );
      }
    }

    return value !== state[key];
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 / core / src / extension-manager.ts View on Github external
extensionSuggesters.forEach(suggester => {
      suggestions.push(...(isArray(suggester) ? suggester : [suggester]));
    });
github ifiokjr / remirror / @remirror / core-extensions / src / extensions / ssr-helpers / ssr-helpers-utils.ts View on Github external
return cloneSSRElement(element, children => {
    if (!isArray(children)) {
      return children;
    }

    return Children.map(children, child => {
      if (!(isReactDOMElement(child) && elementIsEmpty(child) && elementIsOfType(child, 'p'))) {
        return child;
      }

      const props = getElementProps(child);
      return cloneElement(child, props, jsx('br'));
    });
  });
};
github ifiokjr / remirror / @remirror / ui / src / ui-hsl.ts View on Github external
const convertHSLToObject = (value: HSLObject | NamedHSLObject | HSLTuple | string): HSLObject => {
  if (isHSLObject(value)) {
    return value;
  }

  if (isNamedHSLObject(value)) {
    const { hue: h, saturation: s, lightness: l, alpha: a } = value;
    return { h, s, l, a };
  }

  if (isArray(value)) {
    return hslArrayToObject(value);
  }

  if (isString(value)) {
    return hslStringToObject(value);
  }

  throw new Error(`Invalid HSL input value passed: ${isPlainObject(value) ? JSON.stringify(value) : value}`);
};
github ifiokjr / remirror / @remirror / react-utils / src / react-utils.ts View on Github external
export const cloneElement =  }> = any>(
  element: ReactElement,
  props: GProps,
  ...rest: ReactNode[]
) => {
  const children = uniqueArray([
    ...(isArray(props.children) ? props.children : props.children ? [props.children] : []),
    ...rest,
  ]);

  return jsx(
    element.type,
    {
      key: element.key,
      ref: element.props.ref,
      ...element.props,
      ...props,
    },
    ...children,
  );
};