mirror of
https://github.com/embarklabs/embark.git
synced 2025-02-22 18:38:23 +00:00
chore(@embark): move is-valid-domain dependency into embark
This commit is contained in:
parent
332842d101
commit
6f7dd99d57
@ -126,7 +126,6 @@
|
||||
"http-shutdown": "1.2.0",
|
||||
"i18n": "0.8.3",
|
||||
"ipfs-api": "17.2.4",
|
||||
"is-valid-domain": "0.0.5",
|
||||
"istanbul": "0.4.5",
|
||||
"json-parse-better-errors": "1.0.2",
|
||||
"live-plugin-manager-git-fix": "0.12.1",
|
||||
|
@ -334,9 +334,25 @@ function hashTo32ByteHexString(hash) {
|
||||
return '0x' + multihash.toHexString(digest);
|
||||
}
|
||||
|
||||
function isValidDomain(domain) {
|
||||
const isValidDomain = require('is-valid-domain');
|
||||
return isValidDomain(domain);
|
||||
function isValidDomain(v) {
|
||||
// from: https://github.com/miguelmota/is-valid-domain
|
||||
if (typeof v !== 'string') return false;
|
||||
|
||||
var parts = v.split('.');
|
||||
if (parts.length <= 1) return false;
|
||||
|
||||
var tld = parts.pop();
|
||||
var tldRegex = /^(?:xn--)?[a-zA-Z0-9]+$/gi;
|
||||
|
||||
if (!tldRegex.test(tld)) return false;
|
||||
|
||||
var isValid = parts.every(function(host) {
|
||||
var hostRegex = /^(?!:\/\/)([a-zA-Z0-9]+|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])$/gi;
|
||||
|
||||
return hostRegex.test(host);
|
||||
});
|
||||
|
||||
return isValid;
|
||||
}
|
||||
|
||||
function decodeParams(typesArray, hexString) {
|
||||
|
@ -6785,11 +6785,6 @@ is-utf8@^0.2.0:
|
||||
resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72"
|
||||
integrity sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=
|
||||
|
||||
is-valid-domain@0.0.5:
|
||||
version "0.0.5"
|
||||
resolved "https://registry.yarnpkg.com/is-valid-domain/-/is-valid-domain-0.0.5.tgz#48e70319fcb43009236e96b37f9843889ce7b513"
|
||||
integrity sha1-SOcDGfy0MAkjbpazf5hDiJzntRM=
|
||||
|
||||
is-windows@^1.0.0, is-windows@^1.0.1, is-windows@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d"
|
||||
|
Loading…
x
Reference in New Issue
Block a user