winEOL.js
910 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.isWindows = void 0;
function _react() {
const data = _interopRequireDefault(require("react"));
_react = function _react() {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// 在windows环境下,很多工具都会把换行符lf自动改成crlf
// 为了测试精准需要将换行符转化一下
// https://github.com/cssmagic/blog/issues/22
const isWindows = typeof process !== 'undefined' && process.platform === 'win32';
/**
* Convert Windows crlf to lf (\r\n to \n)
* @param content
*/
exports.isWindows = isWindows;
var _default = content => {
if (typeof content !== 'string') {
return content;
}
return isWindows ? content.replace(/\r/g, '') : content;
};
exports.default = _default;