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.

New feature : Option to add leading "?"

See original GitHub issue

Would you be open to PR for adding following option?

Example:

let params = {
"foo": bar
}
const url = `http://abc.com/xyz${stringify(params,{separator:true}})`
//prints http://abc.com/xyz?foo=bar

with falsy params

let params = undefined;
const url = `http://abc.com/xyz${stringify(params,{seperator:true})`
//prints http://abc.com/xyz

Rationale: Avoid ternary checks like this everywhere:

const url = params? 'http://abc.com/xyz?${stringify(params)' : 'http://abc.com/xyz'

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
sindresorhuscommented, Aug 30, 2019

I think it would be better to add a method that does the inverse of .parseUrl().

0reactions
imaegoocommented, Nov 29, 2019

+1

My case:

const obj = {url: 'https://foo.bar', query: {foo: ['bar', 'baz']}}
const options = {arrayFormat: 'bracket'}
queryString.stringifyUrl(obj, options)
//=> 'https://foo.bar?foo[]=bar&foo[]=baz'
Read more comments on GitHub >

github_iconTop Results From Across the Web

Leading zeros in Excel: how to add, remove and hide - Ablebits
This tutorial shows different ways to add leading zeros in Excel: how to keep zeros as you type, show leading zeros in cells,...
Read more >
9 Ways To Add Leading Zeros In Excel
Select the range of cells you want to add leading zeros to and open up the Format Cells dialog box. Right click and...
Read more >
Add Leading Zeros to a Number in Power BI Using Power Query
Learn how to add leading zero in Power BI using Power Query with a very simple step. You will have options to use...
Read more >
iOS 16 - New Features - Apple
Add audiograms to Health. Import your audiograms into the Health app on your iPhone. Additional customization options for Sound Recognition. Train iPhone to ......
Read more >
Add a Leading Zero in Excel | MyExcelOnline
Change format to Text ... Since the reason why the zeros are tossed out is that Excel treats these values as numbers. The...
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