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

additional tlds #8

Closed
wants to merge 1 commit into from
Closed

additional tlds #8

wants to merge 1 commit into from

Conversation

mpal9000
Copy link

My use case:
Validating a url which is a target of a proxy server and is aliased in /etc/hosts to 127.0.0.1. This url in development mode can have a fake ".local" tld, but in production has a real one.

Another use case is when some new tlds become available and the "tlds" dependency in package.json is not up-to-date.

So:

urlRegex({
  exact: true,
  additionalTlds: env == 'development' ? ['local'] : null
}).test('mysite.' + (env == 'development' ? 'local' : 'com'));

My use case:
Validating a url which is a target of a proxy server and is aliased in /etc/hosts to 127.0.0.1. This url in development mode can have a fake ".local" tld, but in production has a real one.

Another use case is when some new tlds become available and the "tlds" dependency in package.json is not up-to-date.

So:
```javascript
urlRegex({
  exact: true,
  additionalTlds: env == 'development' ? ['local'] : null
}).test('mysite.' + (env == 'development' ? 'local' : 'com'));
```
@kevva kevva closed this Jan 19, 2015
@mpal9000
Copy link
Author

why not?

@kevva
Copy link
Owner

kevva commented Jan 19, 2015

It's out of this projects scope.

@mpal9000
Copy link
Author

In my case if I can't pass the "local" tld, I have to use another regex in development...

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

Successfully merging this pull request may close these issues.

2 participants