pkg/js/helpers.js: Prettier.

This commit is contained in:
Tom Limoncelli 2017-12-06 15:55:42 -05:00
parent c6e244d8da
commit 3f8642afda

View file

@ -79,8 +79,8 @@ function D(name, registrar) {
var m = arguments[i]; var m = arguments[i];
processDargs(m, domain); processDargs(m, domain);
} }
if(conf.domain_names.indexOf(name) !== -1) { if (conf.domain_names.indexOf(name) !== -1) {
throw name + " is declared more than once" throw name + ' is declared more than once';
} }
conf.domains.push(domain); conf.domains.push(domain);
conf.domain_names.push(name); conf.domain_names.push(name);
@ -535,46 +535,45 @@ var CF_TEMP_REDIRECT = recordBuilder('CF_TEMP_REDIRECT', {
}, },
}); });
var URL = recordBuilder('URL') var URL = recordBuilder('URL');
var URL301 = recordBuilder('URL301') var URL301 = recordBuilder('URL301');
var FRAME = recordBuilder('FRAME') var FRAME = recordBuilder('FRAME');
// SPF_BUILDER takes an object: // SPF_BUILDER takes an object:
// parts: The parts of the SPF record (to be joined with ' '). // parts: The parts of the SPF record (to be joined with ' ').
// label: The DNS label for the primary SPF record. (default: '@') // label: The DNS label for the primary SPF record. (default: '@')
// raw: If defined, also // raw: Where (which label) to store an unaltered version of the SPF settings.
// split: The template for additional records to be created (default: '_spf%d') // split: The template for additional records to be created (default: '_spf%d')
// flatten: A list of domains to be flattened. // flatten: A list of domains to be flattened.
function SPF_BUILDER(value) { function SPF_BUILDER(value) {
if (!value.parts || value.parts.length < 2) { if (!value.parts || value.parts.length < 2) {
throw "SPF_BUILDER requires at least 2 elements"; throw 'SPF_BUILDER requires at least 2 elements';
} }
if (!value.label) { if (!value.label) {
value.label = "@"; value.label = '@';
} }
if (!value.raw) { if (!value.raw) {
value.raw = "_rawspf"; value.raw = '_rawspf';
} }
r = [] // The list of records to return. r = []; // The list of records to return.
p = {} // The metaparameters to set on the main TXT record. p = {}; // The metaparameters to set on the main TXT record.
rawspf = value.parts.join(" "); // The unaltered SPF settings. rawspf = value.parts.join(' '); // The unaltered SPF settings.
// If flattening is requested, generate a TXT record with the raw SPF settings. // If flattening is requested, generate a TXT record with the raw SPF settings.
if (value.flatten && value.flatten.length > 0) { if (value.flatten && value.flatten.length > 0) {
p.flatten = value.flatten.join(","); p.flatten = value.flatten.join(',');
r.push(TXT(value.raw, rawspf)) r.push(TXT(value.raw, rawspf));
} }
// If overflow is specified, enable splitting. // If overflow is specified, enable splitting.
if (value.overflow) { if (value.overflow) {
p.split = value.overflow p.split = value.overflow;
} }
// Generate a TXT record with the metaparameters. // Generate a TXT record with the metaparameters.
r.push(TXT(value.label, rawspf, p)) r.push(TXT(value.label, rawspf, p));
return r return r;
} }