Skip to content
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

'singleQuotes' option not applied on keys #67

Closed
vishalgakhare opened this issue Aug 16, 2019 · 2 comments
Closed

'singleQuotes' option not applied on keys #67

vishalgakhare opened this issue Aug 16, 2019 · 2 comments

Comments

@vishalgakhare
Copy link

This could be enhancement.
I thought setting 'singleQuotes' to false will make all keys as well as values string.

const logMessage = {name:'vishal'};
console.log(stringifyObject(logMessage, {singleQuotes: false}));

Actual:

{
        name: "vishal"
}

Expected:

 {"name":"vishal"}
@sindresorhus
Copy link
Member

Force-quoting object keys are out of scope of this module. The point of this module is to generate a JS object. If you need quotes keys too, you can just use JSON.stringify().

@vishalgakhare
Copy link
Author

Okay.
The stringify gives double quoted keys but doesn’t stringify nested object values. I thought this package solves that issue, giving true string value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants