This commit is contained in:
Doug Bird 2017-12-13 22:48:32 -08:00
parent af37890a48
commit 661fbc613f
2 changed files with 45 additions and 0 deletions

22
examples/js-demo.js Normal file
View File

@ -0,0 +1,22 @@
//const tldEnum = require('tld-enum');
const tldEnum = require('../formats/js/tld-enum');
console.log("There are " + tldEnum.tldList.length + " IANA TLDs");
let tldCheck;
tldCheck = "com";
console.log("Is '" + tldCheck + "' a real TLD?");
if (tldEnum.tldList.indexOf(tldCheck) != -1) {
console.log(" yes");
} else {
console.log(" no");
}
tldCheck = "somethingWeird";
console.log("Is '" + tldCheck + "' a real TLD?");
if (tldEnum.tldList.indexOf(tldCheck) != -1) {
console.log(" yes");
} else {
console.log(" no");
}

23
examples/php-demo.php Normal file
View File

@ -0,0 +1,23 @@
<?php
use TldEnum\TldEnum;
//require __DIR__ . '/vendor/autoload.php';
require __DIR__ . '/../vendor/autoload.php';
echo "There are " . count(TldEnum::TLD_ENUM) . " IANA TLDs\n";
$tldCheck = "com";
echo "Is '$tldCheck' a real TLD?\n";
if (in_array($tldCheck, TldEnum::TLD_ENUM)) {
echo " yes\n";
} else {
echo " no\n";
}
$tldCheck = "somethingWeird";
echo "Is '$tldCheck' a real TLD?\n";
if (in_array($tldCheck, TldEnum::TLD_ENUM)) {
echo " yes\n";
} else {
echo " no\n";
}