Stringify an object/array like JSON.stringify just without all the double-quotes
by sindresorhusJavaScript
Last 12 weeks · 0 commits
4 of 6 standards met
I saw you merge some PRs. Maybe you will interested in this PR, too? These commits will stringify following object correctly: It also handle comment between function name and function body. (See test cases) I saw you close #65 , but I want this feature, so I add it in my own fork. I add many test cases for this feature. If you would like to merge these commits, I can rebase them on the current version.
Repository: sindresorhus/stringify-object. Description: Stringify an object/array like JSON.stringify just without all the double-quotes Stars: 321, Forks: 47. Primary language: JavaScript. Languages: JavaScript (100%). License: BSD-2-Clause. Latest release: v6.0.0 (5mo ago). Open PRs: 0, open issues: 0. Last activity: 5mo ago. Community health: 85%. Top contributors: sindresorhus, SBoudrias, searls, danilosampaio, arthurvr, verhovsky, cpiber, chuvikovd, forivall, GHolk and others.
It would be nice that the Map object were supported https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map https://stackoverflow.com/questions/29085197/how-do-you-json-stringify-an-es6-map
I believe that doesn't correctly escape special characters in strings. Consider the following program: I'd expect to give results similar to , in that both should return a valid JavaScript expression. However, both the tab character and the backslash are not escaped, but are copied to the output verbatim. In the case of the tab character, the resulting code is unexpected but still technically correct. In the case of the backslash, the resulting code is no valid JavaScript any more, but leaves an unterminated string. Only the newline character is escaped as expected.