nerf-dart.js 471 B

1234567891011121314151617181920212223
  1. var url = require('url')
  2. module.exports = toNerfDart
  3. /**
  4. * Maps a URL to an identifier.
  5. *
  6. * Name courtesy schiffertronix media LLC, a New Jersey corporation
  7. *
  8. * @param {String} uri The URL to be nerfed.
  9. *
  10. * @returns {String} A nerfed URL.
  11. */
  12. function toNerfDart (uri) {
  13. var parsed = url.parse(uri)
  14. delete parsed.protocol
  15. delete parsed.auth
  16. delete parsed.query
  17. delete parsed.search
  18. delete parsed.hash
  19. return url.resolve(url.format(parsed), '.')
  20. }