Skip to content

Commit

Permalink
fix: support all kinds of newlines
Browse files Browse the repository at this point in the history
  • Loading branch information
mdvorak committed Apr 15, 2023
1 parent 3f4bed4 commit a4cdae1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export const empty = (): Properties => ({lines: []})
* @return Parsed configuration.
*/
export const parse = (contents: string): Properties => {
const lines = contents.split(/\r?\n/)
// NOTE all line separators are valid - LF, CRLF, CR
const lines = contents.split(/\r|\r?\n/)

// Remove last line, if empty
if (lines.length > 0 && lines[lines.length - 1].length === 0) {
Expand Down

0 comments on commit a4cdae1

Please sign in to comment.