Lines Matching refs:node
4 function hasChildren(node: React.ReactNode): node is React.ReactElement {
5 return (node as React.ReactElement)?.props?.children !== undefined;
15 export const toString = (node: React.ReactNode): string => {
16 if (typeof node === 'string') {
17 return node;
18 } else if (Array.isArray(node)) {
19 return node.map(toString).join('');
20 } else if (hasChildren(node)) {
21 return toString(node.props.children);
27 export const generateSlug = (slugger: GithubSlugger, node: React.ReactNode, length = 7): string => {
28 const stringToSlug = toString(node).split(' ').splice(0, length).join('-');