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

dedent function and tagged template function #6259

Open
harrysolovay opened this issue Dec 12, 2024 · 1 comment
Open

dedent function and tagged template function #6259

harrysolovay opened this issue Dec 12, 2024 · 1 comment

Comments

@harrysolovay
Copy link
Contributor

Is your feature request related to a problem? Please describe.

A dedent function is a common need when working with tagged template strings, as they enhance the legibility of strings relative to other code (without which indentations become chaotic).

Describe the solution you'd like

A dedent.ts function in the text directory. This file can export an overloaded version of dedent such that it works with both string arguments and template strings arrays + quasis.

Describe alternatives you've considered

While there are other libraries for this, I'd prefer only to use the Deno Standard Library wherever possible. This seems like a good candidate for Deno Standard.

@kt3k
Copy link
Member

kt3k commented Dec 13, 2024

npm:dedent has 27M weekly downloads https://www.npmjs.com/package/dedent

A similar feature is proposed as a language feature (String.dedent) https://github.com/tc39/proposal-string-dedent

I think this is probably a sensible addition to std/text.

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