formats.js 476 B

123456789101112131415161718192021222324
  1. 'use strict';
  2. var replace = String.prototype.replace;
  3. var percentTwenties = /%20/g;
  4. var Format = {
  5. RFC1738: 'RFC1738',
  6. RFC3986: 'RFC3986'
  7. };
  8. module.exports = {
  9. 'default': Format.RFC3986,
  10. formatters: {
  11. RFC1738: function (value) {
  12. return replace.call(value, percentTwenties, '+');
  13. },
  14. RFC3986: function (value) {
  15. return String(value);
  16. }
  17. },
  18. RFC1738: Format.RFC1738,
  19. RFC3986: Format.RFC3986
  20. };