Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const isHSLObject = (value: unknown): value is HSLObject =>
bool(isPlainObject(value) && value.h && value.s && value.l);
export const hasThemeProp = (val: unknown): val is ThemeParams =>
isPlainObject(val) && isPlainObject(val.theme);
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]);
});
}
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,
),
}
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>
export const isSerializedStyle = (val: unknown): val is SerializedStyles =>
isPlainObject(val) && isString(val.name) && isString(val.styles);