1.2.0 • Published 3 years ago

is-allowed v1.2.0

Weekly downloads
6
License
ISC
Repository
github
Last release
3 years ago

Am I Allowed To Redirect

npm i is-allowed

Single domain & tld

const domain = "https://google.com";
const redirect = new Redirect(domain);
redirect.isAllowed("/") // true
redirect.isAllowed("/test") // true

Multiple domain & tld

const domain = "https://google.com";
const redirect = new Redirect(domain, ['com', 'de', 'fr', 'ru']);
redirect.isAllowed("/") // true
redirect.isAllowed("https://google.ru/test") // true

Also supports subdomains.

const domain = "https://google.com";
const redirect = new Redirect(domain, ['com', 'de', 'fr', 'ru']);
redirect.isAllowed("https://subdomain.google.ru/test") // true