Update README.md

must use lowercase for valid TLD comparison
This commit is contained in:
Doug Bird 2017-12-13 23:07:20 -08:00 committed by GitHub
parent bfb9fd5dda
commit 1f0e039b6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 12 deletions

View File

@ -36,7 +36,7 @@ The lists can be conveniently used in PHP or Node projects including this packag
tldCheck = "com"; tldCheck = "com";
console.log("Is '" + tldCheck + "' a real TLD?"); console.log("Is '" + tldCheck + "' a real TLD?");
if (tldEnum.tldList.indexOf(tldCheck) != -1) { if (tldEnum.tldList.indexOf(tldCheck.toLowerCase()) != -1) {
console.log(" yes"); console.log(" yes");
} else { } else {
console.log(" no"); console.log(" no");
@ -44,7 +44,7 @@ The lists can be conveniently used in PHP or Node projects including this packag
tldCheck = "somethingWeird"; tldCheck = "somethingWeird";
console.log("Is '" + tldCheck + "' a real TLD?"); console.log("Is '" + tldCheck + "' a real TLD?");
if (tldEnum.tldList.indexOf(tldCheck) != -1) { if (tldEnum.tldList.indexOf(tldCheck.toLowerCase()) != -1) {
console.log(" yes"); console.log(" yes");
} else { } else {
console.log(" no"); console.log(" no");
@ -85,7 +85,7 @@ The lists can be conveniently used in PHP or Node projects including this packag
$tldCheck = "com"; $tldCheck = "com";
echo "Is '$tldCheck' a real TLD?\n"; echo "Is '$tldCheck' a real TLD?\n";
if (in_array($tldCheck, TldEnum::TLD_ENUM)) { if (in_array(strtolower($tldCheck), TldEnum::TLD_ENUM)) {
echo " yes\n"; echo " yes\n";
} else { } else {
echo " no\n"; echo " no\n";
@ -93,7 +93,7 @@ The lists can be conveniently used in PHP or Node projects including this packag
$tldCheck = "somethingWeird"; $tldCheck = "somethingWeird";
echo "Is '$tldCheck' a real TLD?\n"; echo "Is '$tldCheck' a real TLD?\n";
if (in_array($tldCheck, TldEnum::TLD_ENUM)) { if (in_array(strtolower($tldCheck), TldEnum::TLD_ENUM)) {
echo " yes\n"; echo " yes\n";
} else { } else {
echo " no\n"; echo " no\n";