mirror of
https://github.com/tiennm99/is-a-dev.git
synced 2026-08-10 22:24:54 +00:00
Adds '@' rule for root domain
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"owner": {
|
||||
"username": "phenax",
|
||||
"email": "phenax5@gmail.com"
|
||||
},
|
||||
"record": {
|
||||
"URL": "https://www.is-a.dev"
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -4,6 +4,6 @@
|
||||
"email": "phenax5@gmail.com"
|
||||
},
|
||||
"record": {
|
||||
"CNAME": "placeholder"
|
||||
"CNAME": "placeholder.com"
|
||||
}
|
||||
}
|
||||
|
||||
+7
-4
@@ -18,7 +18,7 @@ const getDomains = () =>
|
||||
name: name.replace(/\.json$/, ''),
|
||||
})));
|
||||
|
||||
const hasLengthLessThan = len => R.compose(R.not, R.lt(len), R.length);
|
||||
const between = (min, max) => num => num >= min && num <= max;
|
||||
|
||||
const validate = pattern => data => R.compose(
|
||||
invalidPairs => invalidPairs.length ? { errors: invalidPairs, valid: false } : { errors: [], valid: true },
|
||||
@@ -34,9 +34,12 @@ const validateNameRecord = type => R.allPass([
|
||||
const validateDomainData = validate({
|
||||
name: {
|
||||
reason: 'The name of the file is invalid',
|
||||
fn: R.allPass([
|
||||
hasLengthLessThan(100),
|
||||
str => str && str.match(/^[A-Za-z0-9\-]{2,}$/ig),
|
||||
fn: R.anyPass([
|
||||
R.equals('@'),
|
||||
R.allPass([
|
||||
R.compose(between(2, 100), R.length),
|
||||
str => str && str.match(/^[A-Za-z0-9\-]+$/ig),
|
||||
])
|
||||
]),
|
||||
},
|
||||
description: { reason: '', fn: R.T, },
|
||||
|
||||
Reference in New Issue
Block a user