How to use 'query-string npm' in JavaScript

Every line of 'query-string npm' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
46function stringifyQuery(query) {
47 var kvs = [];
48
49 for (var key in query) {
50 kvs.push(key + '=' + encodeURIComponent(query[key]));
51 }
52
53 return kvs.join('&');
54}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

189function stringifyQuery (query) {
190 return _.values(_.map(query, stringifyParam)).join('&');
191
192 function stringifyParam (val, key) {
193 return encodeURIComponent(key) + '=' + encodeURIComponent(val);
194 }
195}

Related snippets