暂无描述

examples.js 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /**
  2. * Module dependencies.
  3. */
  4. var qs = require('./');
  5. var obj = qs.parse('foo');
  6. console.log(obj)
  7. var obj = qs.parse('foo=bar=baz');
  8. console.log(obj)
  9. var obj = qs.parse('users[]');
  10. console.log(obj)
  11. var obj = qs.parse('name=tj&email=tj@vision-media.ca');
  12. console.log(obj)
  13. var obj = qs.parse('users[]=tj&users[]=tobi&users[]=jane');
  14. console.log(obj)
  15. var obj = qs.parse('user[name][first]=tj&user[name][last]=holowaychuk');
  16. console.log(obj)
  17. var obj = qs.parse('users[][name][first]=tj&users[][name][last]=holowaychuk');
  18. console.log(obj)
  19. var obj = qs.parse('a=a&a=b&a=c');
  20. console.log(obj)
  21. var obj = qs.parse('user[tj]=tj&user[tj]=TJ');
  22. console.log(obj)
  23. var obj = qs.parse('user[names]=tj&user[names]=TJ&user[names]=Tyler');
  24. console.log(obj)
  25. var obj = qs.parse('user[name][first]=tj&user[name][first]=TJ');
  26. console.log(obj)
  27. var obj = qs.parse('user[0]=tj&user[1]=TJ');
  28. console.log(obj)
  29. var obj = qs.parse('user[0]=tj&user[]=TJ');
  30. console.log(obj)
  31. var obj = qs.parse('user[0]=tj&user[foo]=TJ');
  32. console.log(obj)
  33. var str = qs.stringify({ user: { name: 'Tobi', email: 'tobi@learnboost.com' }});
  34. console.log(str);