@stellar/stellar-sdk
Version:
A library for working with the Stellar network, including communication with the Horizon and Soroban RPC servers.
11 lines (10 loc) • 377 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.validateDomain = validateDomain;
function validateDomain(domain) {
if (!/^(?:[A-Za-z](?:[A-Za-z0-9-]*[A-Za-z0-9])?\.)*[A-Za-z](?:[A-Za-z0-9-]*[A-Za-z0-9])?(?::\d+)?$/.test(domain)) {
throw new Error("The provided domain is invalid. Ensure that the domain adheres to RFC 1035");
}
}