label.js 477 B

12345678910111213141516
  1. 'use strict';
  2. module.exports = label;
  3. /* Stringify a reference label.
  4. * Because link references are easily, mistakingly,
  5. * created (for example, `[foo]`), reference nodes have
  6. * an extra property depicting how it looked in the
  7. * original document, so stringification can cause minimal
  8. * changes. */
  9. function label(node) {
  10. var type = node.referenceType;
  11. var value = type === 'full' ? node.identifier : '';
  12. return type === 'shortcut' ? value : '[' + value + ']';
  13. }