mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2026-07-21 20:55:56 -04:00
use react-innertext
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
// https://stackoverflow.com/a/60564620/1438024
|
||||
const getNodeText = (node) => {
|
||||
if (["string", "number"].includes(typeof node)) {
|
||||
return node;
|
||||
}
|
||||
|
||||
if (node instanceof Array) {
|
||||
return node.map(getNodeText).join("");
|
||||
}
|
||||
|
||||
if (typeof node === "object" && node) {
|
||||
return getNodeText(node.props.children);
|
||||
}
|
||||
};
|
||||
|
||||
export default getNodeText;
|
||||
Reference in New Issue
Block a user