src/js/parse-content.js
function nestHeadingsArray (headingsArray) {
    return reduce.call(headingsArray, function reducer (prev, curr) {
      var currentHeading = getHeadingObject(curr)

      addNode(currentHeading, prev.nest)
      return prev
    }, {
      nest: []
    })
  }
function nestHeadingsArray (headingsArray) {
    return reduce.call(headingsArray, function reducer (prev, curr) {
      var currentHeading = getHeadingObject(curr)

      addNode(currentHeading, prev.nest)
      return prev
    }, {
      nest: []
    })
  }
function nestHeadingsArray ( headingsArray ) { return reduce . call ( headingsArray , function reducer ( prev , curr ) { var currentHeading = getHeadingObject ( curr ) addNode ( currentHeading , prev . nest ) return prev } , { nest : [ ] } ) }
Nest headings array into nested arrays with 'children' property.
@param {Array} headingsArray
@return {Object}
Nest headings array into nested arrays with children property .