question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how to set default option at stringify?? e.g.: `{ indices: false }`

See original GitHub issue

I want use qs.stringify() with { indices: false } option with every call.

is it available? how can I do?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ljharbcommented, Jan 27, 2021

Your only options are:

  • mutate qs, and break anything else that uses it
  • make a wrapper function
  • explicitly use indices: false at every callsite

I suggest option 2 or 3.

1reaction
ljharbcommented, Jan 27, 2021
var stringifyNoIndices = (v, o = {}) => qs.stringify(v, { indices: false, ...o });
Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I set the default value for an HTML <select> element?
The important thing to note is that selected="false" is not allowed and selected="" also makes it selected. The only way to make an...
Read more >
JSON.stringify() - JavaScript - MDN Web Docs
The JSON.stringify() method converts a JavaScript value to a JSON string, optionally replacing values if a replacer function is specified or ...
Read more >
Option cast - CSV Stringify
The cast option define multiple function to transform values based on their type. It is an object where the keys represent the type...
Read more >
ljharb/qs: A querystring parser with nesting support - GitHub
By default, when nesting objects qs will only parse up to 5 children deep. ... You may override this by setting the indices...
Read more >
YAML
To stringify a document as YAML, use toString(options = {}) . This will also be called by String(doc) (with no options). This method...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found