mirror of
https://github.com/status-im/ens-usernames.git
synced 2025-02-23 23:58:16 +00:00
* add checks for TOS violation conditions uppercase letters less than 4 contains 0x * force lowercase on searching * use css for lowercase textTransform * uncomment edit button * add addressLikeUsername to TOS violation check * remove possible state update race condition * add inputs for editing * update embark to web3 version 34
15 lines
502 B
JavaScript
15 lines
502 B
JavaScript
export const addressLikeUsername = username => {
|
|
const length = username.length;
|
|
const firstIsZero = username[0] === "0";
|
|
const secondIsX = username[1].toLowerCase() === "x";
|
|
let isAddress = false;
|
|
if (length > 12 && firstIsZero && secondIsX) {
|
|
username.slice(2, 7).split("").forEach(letter => {
|
|
const code = letter.charCodeAt();
|
|
if ((code >= 48 && code <= 57) || (code >= 97 && code <= 102)) return isAddress = true;
|
|
isAddress = false;
|
|
})
|
|
}
|
|
return isAddress;
|
|
}
|