rofrischmann/alveron

View on GitHub
packages/next-documentation-helpers/src/getHeadingContent.js

Summary

Maintainability
A
0 mins
Test Coverage
import { arrayMap } from 'fast-loops'

function getNodeText(node) {
  if (node.type === 'text') {
    return node.value
  }

  return ''
}

export default function getHeadingContent(children) {
  return arrayMap(children, getNodeText)
}