greenlock.js-ARCHIVED/utils.js

21 lines
306 B
JavaScript
Raw Normal View History

2015-12-11 14:22:46 +00:00
'use strict';
var re = /^[a-zA-Z0-9\.\-]+$/;
var punycode = require('punycode');
var utils = module.exports;
utils.isValidDomain = function (domain) {
if (re.test(domain)) {
return domain;
}
domain = punycode.toASCII(domain);
if (re.test(domain)) {
return domain;
}
return '';
};