normalize_reference.js 400 B

12345678910
  1. 'use strict';
  2. // Hepler to [reference labels]. No better place for this code :)
  3. // It's only for refs/links and should not be exported anywhere.
  4. module.exports = function normalizeReference(str) {
  5. // use .toUpperCase() instead of .toLowerCase()
  6. // here to avoid a conflict with Object.prototype
  7. // members (most notably, `__proto__`)
  8. return str.trim().replace(/\s+/g, ' ').toUpperCase();
  9. };