-
-
Notifications
You must be signed in to change notification settings - Fork 453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New feature : Option to add leading "?" #205
Comments
I think it would be better to add a method that does the inverse of |
+1 I had exactly the same use case: Avoid using ternaries. |
@sindresorhus Can I try to fix this? I'm thinking of creating a method named Example
|
@komcal Sure. |
const obj = {url: 'https://foo.bar', query: {foo: 'bar'}}
queryString.stringifyUrl(obj)
//=> 'https://foo.bar?foo=bar' @sindresorhus Is this ok? |
Yes |
+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' |
Would you be open to PR for adding following option?
Example:
with falsy params
Rationale:
Avoid ternary checks like this everywhere:
const url = params? 'http://abc.com/xyz?${stringify(params)' : 'http://abc.com/xyz'
The text was updated successfully, but these errors were encountered: