helpders.js: Run prettier.

This commit is contained in:
Tom Limoncelli 2018-01-06 15:13:22 -05:00
parent a03c8f19e8
commit 2dd9049582

View file

@ -221,30 +221,30 @@ var TLSA = recordBuilder('TLSA', {
}); });
function isStringOrArray(x) { function isStringOrArray(x) {
return _.isString(x) || _.isArray(x); return _.isString(x) || _.isArray(x);
} }
// TXT(name,target, recordModifiers...) // TXT(name,target, recordModifiers...)
var TXT = recordBuilder("TXT", { var TXT = recordBuilder('TXT', {
args: [["name", _.isString], ["target", isStringOrArray]], args: [['name', _.isString], ['target', isStringOrArray]],
transform: function(record, args, modifiers) { transform: function(record, args, modifiers) {
record.name = args.name; record.name = args.name;
// Store the strings twice: // Store the strings twice:
// .target is the first string // .target is the first string
// .txtstrings is the individual strings. // .txtstrings is the individual strings.
// NOTE: If there are more than 1 string, providers should only access // NOTE: If there are more than 1 string, providers should only access
// .txtstrings, thus it doesn't matter what we store in .target. // .txtstrings, thus it doesn't matter what we store in .target.
// However, by storing the first string there, it improves backwards // However, by storing the first string there, it improves backwards
// compatibility when the len(array) == 1 and (intentionally) breaks // compatibility when the len(array) == 1 and (intentionally) breaks
// broken providers early in the integration tests. // broken providers early in the integration tests.
if (_.isString(args.target)) { if (_.isString(args.target)) {
record.target = args.target; record.target = args.target;
record.txtstrings = [args.target]; record.txtstrings = [args.target];
} else { } else {
record.target = args.target[0] record.target = args.target[0];
record.txtstrings = args.target; record.txtstrings = args.target;
} }
} },
}); });
// MX(name,priority,target, recordModifiers...) // MX(name,priority,target, recordModifiers...)
@ -604,9 +604,9 @@ function SPF_BUILDER(value) {
// Split a DKIM string if it is >254 bytes. // Split a DKIM string if it is >254 bytes.
function DKIM(arr) { function DKIM(arr) {
chunkSize = 255; chunkSize = 255;
var R = []; var R = [];
for (var i = 0, len = arr.length; i < len; i += chunkSize) for (var i = 0, len = arr.length; i < len; i += chunkSize)
R.push(arr.slice(i, i + chunkSize)); R.push(arr.slice(i, i + chunkSize));
return R; return R;
} }