davidbonnet / astring

🌳 Tiny and fast JavaScript code generator from an ESTree-compliant AST.

Home Page:https://david.bonnet.cc/astring/demo/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Single, double and auto quotes

emilos opened this issue · comments

Motivation

As a developer, I'd like to use astring as a part of a code transformation toolchain and pick the type of quotes that are going to be rendered.

Expected behavior

It should be possible to pass a quotes option that accepts: single | double | auto that change the quotes in the output.

Actual behavior

The library preserves existing quotes automatically (which is how auto mode works).

Implementation notes

The change would be non-breaking as the flag could be set to auto by default.

Custom formatting is low-priority and won't be tackled soon. However, a pull request is welcome.