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

add support for regex in client domain definitions #30

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MatthewLarner
Copy link
Owner

@MatthewLarner MatthewLarner commented May 13, 2020

No description provided.

@MatthewLarner MatthewLarner linked an issue May 13, 2020 that may be closed by this pull request
const origin = event.origin || '';

const domain = allowedDomains.find(
(allowedDomain) => origin === allowedDomain.origin || origin.match(allowedDomain.origin),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think origin.match(allowedDomain.origin) already includes origin === allowedDomain.origin so we only need the latter?

Also, i believe match returns an array of possible matches which is not necessary. Maybe we could use test instead?
Something like
(allowedDomain) => new RegExp(allowedDomain).test(origin)
This assumes allowedDomain input is of String type, not a regex literal, so we dont have to check for the type.

@quytx
Copy link

quytx commented Sep 23, 2020

thank you for taking the time on this @MatthewLarner !

@mbrevda
Copy link

mbrevda commented Mar 16, 2021

Any movement on this?

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.

Feature request: add RegExps support for client domain
3 participants