Skip to content

Instantly share code, notes, and snippets.

@tiennou
Created August 29, 2018 12:22
Show Gist options
  • Save tiennou/8adabb4cf5398a83108ccc506e23da7a to your computer and use it in GitHub Desktop.
Save tiennou/8adabb4cf5398a83108ccc506e23da7a to your computer and use it in GitHub Desktop.
dnscontrol multi-dom aliasing
var ALLDOM = function(/* [[base, tld, …] | [dn, …], …], definer */) {
var args = Array.prototype.slice.call(arguments)
var defined = args.shift()
var definer = args.shift()
defined.forEach(function(tlds) {
var base = null
if (Array.isArray(tlds) && tlds.length > 1) {
base = tlds.shift()
} else {
tlds = [tlds]
}
tlds.map(function(tld) { return [base, tld].filter(function(v) { return v; }).join('.') }).forEach(definer)
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment