Created
June 8, 2018 13:23
-
-
Save ahmehri/6910f87f333e761923f8209d68f2d4ab to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const queryString = require('query-string'); | |
const result = queryString.stringify({ name: 'ahmed', items: [1] }); | |
result; | |
const arrayFormat = queryString.stringify( | |
{ name: 'ahmed', items: [1] }, | |
{ arrayFormat: 'bracket' } | |
); | |
arrayFormat; | |
const parsed = queryString.parse(result); | |
parsed; | |
console.log(queryString.stringify(parsed)); | |
const parsedArrayFormat = queryString.parse(arrayFormat, { | |
arrayFormat: 'bracket' | |
}); | |
parsedArrayFormat; | |
/* empty array */ | |
console.log(queryString.stringify({ items: [] })); | |
console.log(queryString.stringify({ items: [] }, { arrayFormat: 'bracket' })); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment