-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add site verification, tests; modularize validators
- Loading branch information
1 parent
965c661
commit 47ee176
Showing
3 changed files
with
61 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
function isValidGitBranch(branch) { | ||
const validGitBranch = /^[a-zA-Z0-9_\-\.\/]+$/; | ||
return validGitBranch.test(branch); | ||
} | ||
|
||
function isValidTwitterHandle(handle) { | ||
const validTwitterHandle = /^\w{1,15}$/; | ||
return validTwitterHandle.test(handle); | ||
} | ||
|
||
function isValidDapAgency(agency) { | ||
const validDapAgency = /^\w{1,15}$/; | ||
return validDapAgency.test(agency); | ||
} | ||
|
||
function isValidAnalyticsId(ga) { | ||
const validAnalyticsId = /^(G|UA|YT|MO)-[a-zA-Z0-9-]+$/; | ||
return validAnalyticsId.test(ga); | ||
} | ||
|
||
function isValidVerificationToken(token) { | ||
const validToken = /^[a-zA-Z0-9_-]{42,44}$/; | ||
return validToken.test(token); | ||
} | ||
|
||
function isValidSearchKey(accessKey) { | ||
const validSearchKey = /^[0-9a-zA-Z]{1,}=*$/; | ||
return validSearchKey.test(accessKey); | ||
} | ||
|
||
function isValidSearchAffiliate(affiliate) { | ||
const validSearchAffiliate = /^[0-9a-z-]{1,}$/; | ||
return validSearchAffiliate.test(affiliate); | ||
} | ||
|
||
module.exports = { | ||
isValidGitBranch, | ||
isValidTwitterHandle, | ||
isValidDapAgency, | ||
isValidAnalyticsId, | ||
isValidVerificationToken, | ||
isValidSearchKey, | ||
isValidSearchAffiliate | ||
}; |