pdf.js/external/crlfchecker/crlfchecker.js
Kalervo Kujala 2ffd3ae1c7 Create crlfchecker module and use it in make.js.
Provide names of the files that contain crlf in the output.
Exit(1) is used instead of throw.
2012-08-20 20:42:21 +03:00

26 lines
633 B
JavaScript

/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
function checkIfCrlfIsPresent(files) {
var failed = [];
(ls(files)).forEach(function checkCrlf(file) {
if ((cat(file)).match(/.*\r.*/)) {
failed.push(file);
}
});
if (failed.length) {
var errorMessage =
'Please remove carriage return\'s from\n' + failed.join('\n') + '\n' +
'Also check your setting for: git config core.autocrlf.';
echo();
echo(errorMessage);
exit(1);
}
}
exports.checkIfCrlfIsPresent = checkIfCrlfIsPresent;