Move private function definitions inside of IIFE (#641)
This commit is contained in:
parent
562cfd7470
commit
6ede83f293
@ -19,7 +19,10 @@
|
||||
* Environment
|
||||
*/
|
||||
|
||||
function _profileConditionTestDomain(urlDomain, domain) {
|
||||
let profileConditionsDescriptor = null;
|
||||
|
||||
const profileConditionsDescriptorPromise = (async () => {
|
||||
function profileConditionTestDomain(urlDomain, domain) {
|
||||
return (
|
||||
urlDomain.endsWith(domain) &&
|
||||
(
|
||||
@ -29,19 +32,16 @@ function _profileConditionTestDomain(urlDomain, domain) {
|
||||
);
|
||||
}
|
||||
|
||||
function _profileConditionTestDomainList(url, domainList) {
|
||||
function profileConditionTestDomainList(url, domainList) {
|
||||
const urlDomain = new URL(url).hostname.toLowerCase();
|
||||
for (const domain of domainList) {
|
||||
if (_profileConditionTestDomain(urlDomain, domain)) {
|
||||
if (profileConditionTestDomain(urlDomain, domain)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
let profileConditionsDescriptor = null;
|
||||
|
||||
const profileConditionsDescriptorPromise = (async () => {
|
||||
const environment = new Environment();
|
||||
await environment.prepare();
|
||||
|
||||
@ -111,7 +111,7 @@ const profileConditionsDescriptorPromise = (async () => {
|
||||
transform: (optionValue) => optionValue.split(/[,;\s]+/).map((v) => v.trim().toLowerCase()).filter((v) => v.length > 0),
|
||||
transformReverse: (transformedOptionValue) => transformedOptionValue.join(', '),
|
||||
validateTransformed: (transformedOptionValue) => (transformedOptionValue.length > 0),
|
||||
test: ({url}, transformedOptionValue) => _profileConditionTestDomainList(url, transformedOptionValue)
|
||||
test: ({url}, transformedOptionValue) => profileConditionTestDomainList(url, transformedOptionValue)
|
||||
},
|
||||
matchRegExp: {
|
||||
name: 'Matches RegExp',
|
||||
|
Loading…
Reference in New Issue
Block a user