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

Browser support #9

Open
Richienb opened this issue Jun 12, 2021 · 7 comments
Open

Browser support #9

Richienb opened this issue Jun 12, 2021 · 7 comments

Comments

@Richienb
Copy link
Contributor

To properly support browsers, replace re2 with re2-wasm

@niftylettuce
Copy link
Collaborator

PR welcome

@Richienb
Copy link
Contributor Author

Are you interested in dropping pre-build tooling and switching to ESM? This would make it easier to get the wasm-reliant code to work.

@pjotrsavitski
Copy link
Contributor

@Richienb I tried to understand the difference between re2 and re2-wasm, but the second one seems to be based on the first and does not seem to have any major differences. Both modules seem to be useful on the Node.js server side and will not work within a browser. Why prefer second over the first?

@Richienb
Copy link
Contributor Author

Why prefer second over the first?

You can not run native modules in the browser. You can run WASM though.

@niftylettuce
Copy link
Collaborator

When would we need url-regex-safe in the browser? Curious what the use cases are. Could just have an API endpoint that takes a string and parses it and returns it and then calls new RegExp with value?

@Richienb
Copy link
Contributor Author

Richienb commented Sep 23, 2021

For libraries that validate urls before sending a request to them, making the validation an API endpoint would make this redundant. In this case, you might as well send the request in the first place and handle the error.

@pjotrsavitski
Copy link
Contributor

pjotrsavitski commented Sep 23, 2021

I'm using it in the browser to create a version of the text that will have any URL's converted into HTML with newlines converted to line breaks. Using a module, which was url-regex, instead of my own regular expression made sense.

Having an API endpoint do that for each of the items in the listing does not seem like a good idea.

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

3 participants