Merge pull request #4172 from Snarling/IPs-fix

CCT: Generate IPs contract type accepts properly formatted js array
This commit is contained in:
hydroflame 2022-10-04 11:58:26 -04:00 committed by GitHub
commit 4d1e72bf7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -490,8 +490,8 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [
"Note that an octet cannot begin with a '0' unless the number", "Note that an octet cannot begin with a '0' unless the number",
"itself is actually 0. For example, '192.168.010.1' is not a valid IP.\n\n", "itself is actually 0. For example, '192.168.010.1' is not a valid IP.\n\n",
"Examples:\n\n", "Examples:\n\n",
"25525511135 -> [255.255.11.135, 255.255.111.35]\n", '25525511135 -> ["255.255.11.135", "255.255.111.35"]\n',
"1938718066 -> [193.87.180.66]", '1938718066 -> ["193.87.180.66"]',
].join(" "); ].join(" ");
}, },
difficulty: 3, difficulty: 3,
@ -532,7 +532,7 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [
} }
const sanitizedAns: string = removeBracketsFromArrayString(ans).replace(/\s/g, ""); const sanitizedAns: string = removeBracketsFromArrayString(ans).replace(/\s/g, "");
const ansArr: string[] = sanitizedAns.split(","); const ansArr: string[] = sanitizedAns.split(",").map((ip) => ip.replace(/^"|"$/g, ""));
if (ansArr.length !== ret.length) { if (ansArr.length !== ret.length) {
return false; return false;
} }