uri.js 392 B

123456789101112131415161718
  1. 'use strict';
  2. const URI = require('urijs');
  3. const qs = require('qs');
  4. const uri = '/weixin/api/fetch?id=123&corp=345';
  5. const parsed = URI.parse(uri);
  6. console.log(parsed);
  7. console.log(URI.parseQuery(parsed.query));
  8. console.log(URI.parseQuery(''));
  9. console.log(qs.parse(uri));
  10. const query = console.log(qs.stringify({}));
  11. if (query) {
  12. console.log('true');
  13. } else {
  14. console.log(false);
  15. }