Skip to content

Commit 16af6b0

Browse files
committed
[Fix #133] StringReader fails to normalize Windows line endings
[Fix #133] StringReader fails to normalize Windows line endings `\r` matches a carriage return `\n` matches a newline character. `{1, 2}` matches between either 1 or 2 of the preceding tokens This way you can start with either and should cover both linux or windows to fix #133
1 parent 77e3d0b commit 16af6b0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: src/util/StringReader.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function StringReader(text){
1313
* @type String
1414
* @private
1515
*/
16-
this._input = text.replace(/\n\r?/g, "\n");
16+
this._input = text.replace(/(\r|\n){1,2}/g, "\n");
1717

1818

1919
/**
@@ -264,4 +264,4 @@ StringReader.prototype = {
264264
return buffer;
265265
}
266266

267-
};
267+
};

0 commit comments

Comments
 (0)