list-of-top-level-domains/examples/js-demo.js

21 lines
529 B
JavaScript
Raw Normal View History

version 2 - refactor js files to be proper module exportrs with an index.js - fix inconsistent naming of TLD format files containing simple array of each TLD; now all named using the "list" suffix instead of some using "enum" - formats/js/tld-enum/list.js - formats/json/tld-list.json - formats/php/TldEnum/TldList.php - new "desc" (description) format file; hashmap of each TLD with corresponding description - formats/js/tld-enum/desc.js - formats/json/tld-desc.json - formats/php/TldEnum/TldDesc.php - new "type" format file; hashmap of each TLD with corresponding TLD type - formats/js/tld-enum/type.js - formats/json/tld-type.json - formats/php/TldEnum/TldType.php - new "info" format file; array of each TLD with hashmap containing the "domain", "description", and "type" properties - formats/js/tld-enum/info.js - formats/json/tld-info.json - formats/php/TldEnum/TldInfo.php - examples for new format files - examples/js-desc-demo.js - examples/js-info-demo.js - examples/js-type-demo.js - examples/php-TldDesc-demo.php - examples/php-TldInfo-demo.php - examples/php-TldType-demo.php - fixes to bin/update-formats.sh - can now skip downloading data from IANA - creates new format files with newly created helpers - created new helpers for new format files - bin/helpers/generate-js-tld-desc.js - bin/helpers/generate-js-tld-info.js - bin/helpers/generate-js-tld-type.js - bin/helpers/generate-json-tld-desc.js - bin/helpers/generate-json-tld-info.js - bin/helpers/generate-json-tld-type.js - bin/helpers/generate-php-tld-desc.php - bin/helpers/generate-php-tld-info.php - bin/helpers/generate-php-tld-type.php
2018-06-13 05:51:12 +00:00
const tldList = require('../formats/js/tld-enum/list');
2017-12-14 06:48:32 +00:00
version 2 - refactor js files to be proper module exportrs with an index.js - fix inconsistent naming of TLD format files containing simple array of each TLD; now all named using the "list" suffix instead of some using "enum" - formats/js/tld-enum/list.js - formats/json/tld-list.json - formats/php/TldEnum/TldList.php - new "desc" (description) format file; hashmap of each TLD with corresponding description - formats/js/tld-enum/desc.js - formats/json/tld-desc.json - formats/php/TldEnum/TldDesc.php - new "type" format file; hashmap of each TLD with corresponding TLD type - formats/js/tld-enum/type.js - formats/json/tld-type.json - formats/php/TldEnum/TldType.php - new "info" format file; array of each TLD with hashmap containing the "domain", "description", and "type" properties - formats/js/tld-enum/info.js - formats/json/tld-info.json - formats/php/TldEnum/TldInfo.php - examples for new format files - examples/js-desc-demo.js - examples/js-info-demo.js - examples/js-type-demo.js - examples/php-TldDesc-demo.php - examples/php-TldInfo-demo.php - examples/php-TldType-demo.php - fixes to bin/update-formats.sh - can now skip downloading data from IANA - creates new format files with newly created helpers - created new helpers for new format files - bin/helpers/generate-js-tld-desc.js - bin/helpers/generate-js-tld-info.js - bin/helpers/generate-js-tld-type.js - bin/helpers/generate-json-tld-desc.js - bin/helpers/generate-json-tld-info.js - bin/helpers/generate-json-tld-type.js - bin/helpers/generate-php-tld-desc.php - bin/helpers/generate-php-tld-info.php - bin/helpers/generate-php-tld-type.php
2018-06-13 05:51:12 +00:00
console.log("There are " + tldList.length + " IANA TLDs");
2017-12-14 06:48:32 +00:00
let tldCheck;
tldCheck = "com";
console.log("Is '" + tldCheck + "' a real TLD?");
version 2 - refactor js files to be proper module exportrs with an index.js - fix inconsistent naming of TLD format files containing simple array of each TLD; now all named using the "list" suffix instead of some using "enum" - formats/js/tld-enum/list.js - formats/json/tld-list.json - formats/php/TldEnum/TldList.php - new "desc" (description) format file; hashmap of each TLD with corresponding description - formats/js/tld-enum/desc.js - formats/json/tld-desc.json - formats/php/TldEnum/TldDesc.php - new "type" format file; hashmap of each TLD with corresponding TLD type - formats/js/tld-enum/type.js - formats/json/tld-type.json - formats/php/TldEnum/TldType.php - new "info" format file; array of each TLD with hashmap containing the "domain", "description", and "type" properties - formats/js/tld-enum/info.js - formats/json/tld-info.json - formats/php/TldEnum/TldInfo.php - examples for new format files - examples/js-desc-demo.js - examples/js-info-demo.js - examples/js-type-demo.js - examples/php-TldDesc-demo.php - examples/php-TldInfo-demo.php - examples/php-TldType-demo.php - fixes to bin/update-formats.sh - can now skip downloading data from IANA - creates new format files with newly created helpers - created new helpers for new format files - bin/helpers/generate-js-tld-desc.js - bin/helpers/generate-js-tld-info.js - bin/helpers/generate-js-tld-type.js - bin/helpers/generate-json-tld-desc.js - bin/helpers/generate-json-tld-info.js - bin/helpers/generate-json-tld-type.js - bin/helpers/generate-php-tld-desc.php - bin/helpers/generate-php-tld-info.php - bin/helpers/generate-php-tld-type.php
2018-06-13 05:51:12 +00:00
if (tldList.indexOf(tldCheck.toLowerCase()) != -1) {
2017-12-14 06:48:32 +00:00
console.log(" yes");
} else {
console.log(" no");
}
tldCheck = "somethingWeird";
console.log("Is '" + tldCheck + "' a real TLD?");
version 2 - refactor js files to be proper module exportrs with an index.js - fix inconsistent naming of TLD format files containing simple array of each TLD; now all named using the "list" suffix instead of some using "enum" - formats/js/tld-enum/list.js - formats/json/tld-list.json - formats/php/TldEnum/TldList.php - new "desc" (description) format file; hashmap of each TLD with corresponding description - formats/js/tld-enum/desc.js - formats/json/tld-desc.json - formats/php/TldEnum/TldDesc.php - new "type" format file; hashmap of each TLD with corresponding TLD type - formats/js/tld-enum/type.js - formats/json/tld-type.json - formats/php/TldEnum/TldType.php - new "info" format file; array of each TLD with hashmap containing the "domain", "description", and "type" properties - formats/js/tld-enum/info.js - formats/json/tld-info.json - formats/php/TldEnum/TldInfo.php - examples for new format files - examples/js-desc-demo.js - examples/js-info-demo.js - examples/js-type-demo.js - examples/php-TldDesc-demo.php - examples/php-TldInfo-demo.php - examples/php-TldType-demo.php - fixes to bin/update-formats.sh - can now skip downloading data from IANA - creates new format files with newly created helpers - created new helpers for new format files - bin/helpers/generate-js-tld-desc.js - bin/helpers/generate-js-tld-info.js - bin/helpers/generate-js-tld-type.js - bin/helpers/generate-json-tld-desc.js - bin/helpers/generate-json-tld-info.js - bin/helpers/generate-json-tld-type.js - bin/helpers/generate-php-tld-desc.php - bin/helpers/generate-php-tld-info.php - bin/helpers/generate-php-tld-type.php
2018-06-13 05:51:12 +00:00
if (tldList.indexOf(tldCheck.toLowerCase()) != -1) {
2017-12-14 06:48:32 +00:00
console.log(" yes");
} else {
console.log(" no");
}