Skip to content
This repository was archived by the owner on Feb 18, 2025. It is now read-only.

Commit 1e2e950

Browse files
authored
Merge pull request #46 from benjamingr/benjamingr-patch-1
Update README.md
2 parents e039c25 + 2c36a8a commit 1e2e950

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,15 @@ The one obscure case where this could suggest a cause for escaping, avoiding a r
8484
8585
EscapeRegExpPattern (as the name implies) takes a pattern and escapes it so that it can be represented as a string. What `RegExp.escape` does is take a string and escapes it so it can be literally represented as a pattern. The two do not need to share an escaped set and we can't use one for the other. We're discussing renaming EscapeRegExpPattern in the spec in the future to avoid confusion for readers.
8686
87+
* **Why not `RegExp.tag` or another tagged template based proposal?**
88+
89+
During the last time this proposal was presented - an edge case was brought up where tagged templates were suggested as an alternative. We believe a simple function is a much better and simpler alternative to tagged templates here:
90+
- Users have consistently been asking for `RegExp.escape` over the past 5 years - both in this repo and elsewhere. Packages providing this functionality are [very popular](https://www.npmjs.com/package/escape-regexp). For comparison there are no downloads and [zero issues or interest](https://github.com/benjamingr/RegExp.tag) when I initiated work on a tag proposal.
91+
- When interviewing users regarding `RegExp.tag` when trying to get motivating use cases for the API - users spoken with were very confused because of the tagged templates. The feedback was negative enough and they found the API confusing and awkward enough for me to stop pursuing it.
92+
- Virtually every other programming language offers `.escape` (see "in other languages") and made the trade-off to ship `.escape` eventhough most of these could have shipped a tagged template API (equivalent, per language).
93+
- This proposal does not block effort on a tag proposal, the two proposals are not mutually exclusive and both APIs can eventually land.
94+
See [this issue](https://github.com/benjamingr/RegExp.escape/issues/45) for discussion.
95+
8796
* **Why don't you do X?**
8897
8998
If you believe there is a concern that was not addressed yet, please [open an issue](https://github.com/benjamingr/RexExp.escape/issues).

0 commit comments

Comments
 (0)