From 661fbc613fa383db65ac1ca82417d5fac01e0d1e Mon Sep 17 00:00:00 2001 From: Doug Bird Date: Wed, 13 Dec 2017 22:48:32 -0800 Subject: [PATCH] examples --- examples/js-demo.js | 22 ++++++++++++++++++++++ examples/php-demo.php | 23 +++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 examples/js-demo.js create mode 100644 examples/php-demo.php diff --git a/examples/js-demo.js b/examples/js-demo.js new file mode 100644 index 0000000..4ff7642 --- /dev/null +++ b/examples/js-demo.js @@ -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"); +} \ No newline at end of file diff --git a/examples/php-demo.php b/examples/php-demo.php new file mode 100644 index 0000000..8f4f765 --- /dev/null +++ b/examples/php-demo.php @@ -0,0 +1,23 @@ +