mirror of
https://github.com/actions/setup-python.git
synced 2025-06-28 21:53:47 +00:00
Fix.
This commit is contained in:
parent
7fe1ba03a3
commit
ec0a863019
7020 changed files with 1880198 additions and 489 deletions
24
node_modules/detect-newline/index.js
generated
vendored
Normal file
24
node_modules/detect-newline/index.js
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
'use strict';
|
||||
module.exports = function (str) {
|
||||
if (typeof str !== 'string') {
|
||||
throw new TypeError('Expected a string');
|
||||
}
|
||||
|
||||
var newlines = (str.match(/(?:\r?\n)/g) || []);
|
||||
|
||||
if (newlines.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var crlf = newlines.filter(function (el) {
|
||||
return el === '\r\n';
|
||||
}).length;
|
||||
|
||||
var lf = newlines.length - crlf;
|
||||
|
||||
return crlf > lf ? '\r\n' : '\n';
|
||||
};
|
||||
|
||||
module.exports.graceful = function (str) {
|
||||
return module.exports(str) || '\n';
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue