amazon-route-53-dns-zone-file
Version:
Makes DNS Zone File easy. Parses and validates BIND zone files and can be extended for custom features. Functionality is modular. Features are made open for extension and closed for runtime mutation. Written in TypeScript.
31 lines • 1.35 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.newLinesIntoSpaces = exports.splitByNewLine = exports.unifyNewLine = exports.UNIX_NEW_LINE_CHAR = exports.matchDigitWithNumber = exports.match = exports.withDot = exports.trimDot = exports.hasNumbers = exports.hasLetters = void 0;
const hasLetters = (x) => /[a-z]/i.test(x);
exports.hasLetters = hasLetters;
const hasNumbers = (x) => /\d/.test(x);
exports.hasNumbers = hasNumbers;
const trimDot = (x) => x.replace(/\.$/, '');
exports.trimDot = trimDot;
const withDot = (x) => exports.trimDot(x) + '.';
exports.withDot = withDot;
const match = (pattern, input) => {
if (typeof input === 'string') {
return input.match(pattern) || [];
}
else {
return [];
}
};
exports.match = match;
exports.matchDigitWithNumber = /(\d+)([a-z]+)/gim;
exports.UNIX_NEW_LINE_CHAR = '\n';
const unifyNewLine = (value) => value
.replace(/\\n/, exports.UNIX_NEW_LINE_CHAR)
.replace(/\r\n?/g, exports.UNIX_NEW_LINE_CHAR);
exports.unifyNewLine = unifyNewLine;
const splitByNewLine = (value) => exports.unifyNewLine(value).split(exports.UNIX_NEW_LINE_CHAR);
exports.splitByNewLine = splitByNewLine;
const newLinesIntoSpaces = (value) => value.replace(/\n/g, ' ');
exports.newLinesIntoSpaces = newLinesIntoSpaces;
//# sourceMappingURL=utils_generic.js.map