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