merge utils,common -> common
This commit is contained in:
parent
ce9d19a8b0
commit
46516d5fbb
2
index.js
2
index.js
|
@ -107,7 +107,7 @@ LE.create = function (defaults, handlers, backend) {
|
|||
|
||||
backend = PromiseA.promisifyAll(backend);
|
||||
|
||||
var utils = require('./lib/utils');
|
||||
var utils = require('./lib/common');
|
||||
//var attempts = {}; // should exist in master process only
|
||||
var le;
|
||||
|
||||
|
|
|
@ -3,6 +3,23 @@
|
|||
var fs = require('fs');
|
||||
var PromiseA = require('bluebird');
|
||||
|
||||
var re = /^[a-zA-Z0-9\.\-]+$/;
|
||||
var punycode = require('punycode');
|
||||
|
||||
mudole.exports.isValidDomain = function (domain) {
|
||||
if (re.test(domain)) {
|
||||
return domain;
|
||||
}
|
||||
|
||||
domain = punycode.toASCII(domain);
|
||||
|
||||
if (re.test(domain)) {
|
||||
return domain;
|
||||
}
|
||||
|
||||
return '';
|
||||
};
|
||||
|
||||
module.exports.tplConfigDir = function merge(configDir, defaults) {
|
||||
Object.keys(defaults).forEach(function (key) {
|
||||
if ('string' === typeof defaults[key]) {
|
||||
|
|
20
lib/utils.js
20
lib/utils.js
|
@ -1,20 +0,0 @@
|
|||
'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 '';
|
||||
};
|
Loading…
Reference in New Issue