url-regex icon indicating copy to clipboard operation
url-regex copied to clipboard

Pass in own list of TLDs

Open osdiab opened this issue 4 years ago • 1 comments

Context at #65

Didn't add typings or readme yet, want to see if this kind of API is something you'd be open to. Adds a new entry point to preserve behavior of import, where doing so provides the same functionality but with an extra tlds option to provide the list of TLDs yourself.

Flow to use this would be to import it from url-regex/make-url-regex instead of just url-regex, allowing the library to be used without pulling in the tlds library, making this a much smaller library to include and flexible for niche URL schemes like .onion.

Naming kinda crappy but idk what would be better. Assumed wanted to preserve default behavior so intentionally didn't introduce to index.js.

osdiab avatar Oct 18 '19 04:10 osdiab

This issue is fixed in my maintained and modern version of this package at https://github.com/niftylettuce/url-regex-safe. You should be able to switch from url-regex to url-regex-safe now. See the updated list of options as I added some new ones, and changed a few defaults to more sensible ones (since not everyone is parsing Markdown for instance).

It has an option to pass tlds (Array) 👍

niftylettuce avatar Aug 15 '20 08:08 niftylettuce