"use strict";

var renderNull = function () { return 'NULL' }
  , parser

parser = require('editorsnotes-markup-parser')({
  projectBaseURL: '/',
  resolveItemText: renderNull,
  makeBibliographyEntry: renderNull,
  makeInlineCitation: function(citations) {
    return { citations: citations.map(renderNull) }
  }
});

function getENReferences(nodeArray, items) {
  items = items || {};

  return nodeArray.reduce(function (acc, node) {
    if (node.meta && node.meta.enItemType) {
      let itemType = node.meta.enItemType
        , itemID = node.meta.enItemID

      if (!acc.hasOwnProperty(itemType)) acc[itemType] = [];
      if (acc[itemType].indexOf(itemID) === -1) acc[itemType].push(itemID);
    }

    return node.children ? getENReferences(node.children, acc) : acc;
  }, items)
}

module.exports = function (text) {
  return getENReferences(parser.parse(text))
}

@@ -862,13 +862,17 @@
 rse(text
+, %7B%7D
 ))%0A%7D%0A

Add second argument to parse()