{"library":"qs-parser","title":"QS - Query String Parser","description":"The `qs-parser` package, often referred to as `QS`, provides a lightweight utility for parsing, manipulating, and reconstructing URL query strings. It enables developers to easily extract individual query parameters, retrieve all parameters as an object, and verify the existence of specific keys. The library supports dynamic modification of query strings by adding new tokens, updating existing values, or completely removing parameters. A distinctive feature is its `go()` method, which can directly navigate the browser to the newly constructed URL. It handles URL encoding/decoding automatically and performs type conversion for numbers and arrays, with array parameters requiring a `[]` suffix in their key names. The current stable version is `0.4.8`. Given the inactivity in its GitHub repository, the project appears to be abandoned, meaning there are no active developments or a defined release cadence.","language":"javascript","status":"abandoned","last_verified":"Sun Apr 19","install":{"commands":["npm install qs-parser"],"cli":null},"imports":["const QS = require('qs-parser');","QS('http://example.com?foo=bar').get('foo');","QS().get('key');"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const QS = require('qs-parser');\n\n// Example URL for demonstration\nconst currentUrl = 'http://www.somedomain.com/somepage?foo=bar&email=nire0510%40gmail.com&number=345.678&cars%5B%5D=BMW&cars%5B%5D=Audi';\n\n// Initialize QS parser with a specific URL\nconst qs = QS(currentUrl);\n\nconsole.log('--- Read Operations ---');\nconsole.log('Original URL:', qs.url);\nconsole.log('Value of \"foo\":', qs.get('foo')); // Expected: 'bar'\nconsole.log('Value of \"email\":', qs.get('email')); // Expected: 'nire0510@gmail.com'\nconsole.log('Value of \"number\":', qs.get('number')); // Expected: 345.678\nconsole.log('Value of \"cars[]\":', qs.get('cars[]')); // Expected: ['BMW', 'Audi']\nconsole.log('All tokens:', qs.getAll()); // Expected: { foo: 'bar', email: 'nire0510@gmail.com', number: 345.678, 'cars[]': [ 'BMW', 'Audi' ] }\nconsole.log('Does \"foo\" exist?', qs.has('foo')); // Expected: true\n\nconsole.log('\\n--- Write Operations (Chainable) ---');\nqs.set('foo', 'newBar') // Change existing value\n  .set('dal', 'mon') // Add a new token\n  .remove('number'); // Remove a token\n\nconsole.log('Modified URL property (before .go()):', qs.url);\n// Expected URL to resemble: \"http://www.somedomain.com/somepage?foo=newBar&email=nire0510%40gmail.com&cars%5B%5D=BMW&cars%5B%5D=Audi&dal=mon\"\n\n// In a browser, calling .go() would navigate to the new URL.\n// For this runnable example, we'll avoid actual navigation.\n// console.log('\\nNavigating (if .go() was called):', qs.go());","lang":"javascript","description":"This example demonstrates how to initialize `qs-parser` with a URL, perform various read operations to retrieve parameters and check their existence, and then chain multiple write operations (set, add, remove) to modify the query string. It also shows the updated `url` property on the `qs` instance.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}