From ed71dd014ce07bbce92231a064242d0161678394 Mon Sep 17 00:00:00 2001 From: Ivan Zverev Date: Mon, 19 Aug 2019 17:53:24 +0300 Subject: [PATCH] Issue #181: Updated readme file - added info about allowSparse option --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index cb47d60a..514afcb0 100644 --- a/README.md +++ b/README.md @@ -227,6 +227,13 @@ var noSparse = qs.parse('a[1]=b&a[15]=c'); assert.deepEqual(noSparse, { a: ['b', 'c'] }); ``` +You may also use `allowSparse` option to parse sparse arrays: + +```javascript +var sparseArray = qs.parse('a[1]=2&a[3]=5', { allowSparse: true }); +assert.deepEqual(sparseArray, { a: [, '2', , '5'] }); +``` + Note that an empty string is also a value, and will be preserved: ```javascript