mirror of
https://github.com/tiennm99/is-a-dev.git
synced 2026-07-20 02:18:39 +00:00
feat: adds support for dots in subdomain names
This commit is contained in:
+11
-5
@@ -5,7 +5,7 @@ const INVALID_NAMES = require('./invalid-domains.json');
|
||||
|
||||
const isValidURL = and([R.is(String), testRegex(/^https?:\/\//ig)]);
|
||||
|
||||
const isValidDomain = and([R.is(String), testRegex(/^(([a-z0-9\-]+)\.)+[a-z]+$/ig)]);
|
||||
const isValidDomain = and([R.is(String), testRegex(/^(([a-z0-9-]+)\.)+[a-z]+$/ig)]);
|
||||
|
||||
const validateCnameRecord = type => and([
|
||||
R.propIs(String, type),
|
||||
@@ -27,13 +27,19 @@ const validateMXRecord = type => and([
|
||||
|
||||
const validateDomainData = validate({
|
||||
name: {
|
||||
reason: 'The name of the file is invalid. It must be lowercased, alphanumeric and more than 2 characters long',
|
||||
reason: 'The name of the file is invalid. It must be lowercased, alphanumeric and each component must be more than 2 characters long',
|
||||
fn: or([
|
||||
R.equals('@'),
|
||||
and([
|
||||
R.compose(between(2, 100), R.length),
|
||||
testRegex(/^[a-z0-9-]+$/g),
|
||||
R.complement(R.includes(R.__, INVALID_NAMES)),
|
||||
R.is(String),
|
||||
R.compose(
|
||||
R.all(and([
|
||||
R.compose(between(2, 100), R.length),
|
||||
testRegex(/^[a-z0-9-]+$/g),
|
||||
R.complement(R.includes(R.__, INVALID_NAMES)),
|
||||
])),
|
||||
R.split('.'),
|
||||
),
|
||||
])
|
||||
]),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user