Replying to Avatar Dan

```

async function checkNameAvailability(name, domainName, quoteOptions) {

let domain = config.domains[domainName];

if (name.length < domain.minLength)

return { available: false, why: "TOO_SHORT" };

if (name.length > domain.maxLength)

return { available: false, why: "TOO_LONG" };

if (!domain.regex.test(name))

return { available: false, why: "REGEX" };

let tmp = domain.disallowedNames.find(el => {

let v = el instanceof Array ? el[0] : el;

return (v instanceof RegExp ? v.test(name) : name === v);

});

if (tmp)

return { available: false, why: "DISALLOWED", reasonTag: (tmp instanceof Array) ? tmp[1] : null };

let registration = await sqlGetRegistration.get({ name: name, domain: domainName });

if (registration && registration.count)

return { available: false, why: "REGISTERED" };

return { available: true, quote: await quoteNamePrice(name, domain, quoteOptions) };

}

```

Avatar
Kieran 2y ago

nostr:npub1tsgw6pncspg4d5u778hk63s3pls70evs4czfsmx0fzap9xwt203qtkhtk4 Find the bug in this code block

Reply to this note

Please Login to reply.

Discussion

No replies yet.