| | |
| | | # qs <sup>[![Version Badge][2]][1]</sup> |
| | | |
| | | [![Build Status][3]][4] |
| | | [![dependency status][5]][6] |
| | | [![dev dependency status][7]][8] |
| | | [![github actions][actions-image]][actions-url] |
| | | [![coverage][codecov-image]][codecov-url] |
| | | [![dependency status][deps-svg]][deps-url] |
| | | [![dev dependency status][dev-deps-svg]][dev-deps-url] |
| | | [![License][license-image]][license-url] |
| | | [![Downloads][downloads-image]][downloads-url] |
| | | |
| | | [![npm badge][11]][1] |
| | | [![npm badge][npm-badge-png]][package-url] |
| | | |
| | | A querystring parsing and stringifying library with some added security. |
| | | |
| | |
| | | assert.deepEqual(arraysOfObjects, { a: ['b', 'c'] }) |
| | | ``` |
| | | (_this cannot convert nested objects, such as `a={b:1},{c:d}`_) |
| | | |
| | | ### Parsing primitive/scalar values (numbers, booleans, null, etc) |
| | | |
| | | By default, all values are parsed as strings. This behavior will not change and is explained in [issue #91](https://github.com/ljharb/qs/issues/91). |
| | | |
| | | ```javascript |
| | | var primitiveValues = qs.parse('a=15&b=true&c=null'); |
| | | assert.deepEqual(primitiveValues, { a: '15', b: 'true', c: 'null' }); |
| | | ``` |
| | | |
| | | If you wish to auto-convert values which look like numbers, booleans, and other values into their primitive counterparts, you can use the [query-types Express JS middleware](https://github.com/xpepermint/query-types) which will auto-convert all request query parameters. |
| | | |
| | | ### Stringifying |
| | | |
| | |
| | | |
| | | The maintainers of qs and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-qs?utm_source=npm-qs&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) |
| | | |
| | | [1]: https://npmjs.org/package/qs |
| | | [2]: http://versionbadg.es/ljharb/qs.svg |
| | | [3]: https://api.travis-ci.org/ljharb/qs.svg |
| | | [4]: https://travis-ci.org/ljharb/qs |
| | | [5]: https://david-dm.org/ljharb/qs.svg |
| | | [6]: https://david-dm.org/ljharb/qs |
| | | [7]: https://david-dm.org/ljharb/qs/dev-status.svg |
| | | [8]: https://david-dm.org/ljharb/qs?type=dev |
| | | [9]: https://ci.testling.com/ljharb/qs.png |
| | | [10]: https://ci.testling.com/ljharb/qs |
| | | [11]: https://nodei.co/npm/qs.png?downloads=true&stars=true |
| | | [license-image]: http://img.shields.io/npm/l/qs.svg |
| | | [package-url]: https://npmjs.org/package/qs |
| | | [npm-version-svg]: https://versionbadg.es/ljharb/qs.svg |
| | | [deps-svg]: https://david-dm.org/ljharb/qs.svg |
| | | [deps-url]: https://david-dm.org/ljharb/qs |
| | | [dev-deps-svg]: https://david-dm.org/ljharb/qs/dev-status.svg |
| | | [dev-deps-url]: https://david-dm.org/ljharb/qs#info=devDependencies |
| | | [npm-badge-png]: https://nodei.co/npm/qs.png?downloads=true&stars=true |
| | | [license-image]: https://img.shields.io/npm/l/qs.svg |
| | | [license-url]: LICENSE |
| | | [downloads-image]: http://img.shields.io/npm/dm/qs.svg |
| | | [downloads-url]: http://npm-stat.com/charts.html?package=qs |
| | | [downloads-image]: https://img.shields.io/npm/dm/qs.svg |
| | | [downloads-url]: https://npm-stat.com/charts.html?package=qs |
| | | [codecov-image]: https://codecov.io/gh/ljharb/qs/branch/main/graphs/badge.svg |
| | | [codecov-url]: https://app.codecov.io/gh/ljharb/qs/ |
| | | [actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/qs |
| | | [actions-url]: https://github.com/ljharb/qs/actions |