Skip to content

Commit

Permalink
Do not quote ini values with error constants
Browse files Browse the repository at this point in the history
  • Loading branch information
shivammathur committed Feb 4, 2021
1 parent ecc8611 commit 1686147
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions __tests__/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ describe('Utils tests', () => {
'b=3, 4',
'c=5'
]);
expect(
await utils.CSVArray('a=E_ALL, b=E_ALL & ~ E_ALL, c="E_ALL", d=\'E_ALL\'')
).toEqual(['a=E_ALL', 'b=E_ALL & ~ E_ALL', 'c=E_ALL', 'd=E_ALL']);
expect(await utils.CSVArray('')).toEqual([]);
expect(await utils.CSVArray(' ')).toEqual([]);
});
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1285,7 +1285,7 @@ async function CSVArray(values_csv) {
return value
.trim()
.replace(/^["']|["']$|(?<==)["']/g, '')
.replace(/=(.*[?{}|&~![()^]+.*)/, "='$1'");
.replace(/=(((?!E_).)*[?{}|&~![()^]+((?!E_).)+)/, "='$1'");
})
.filter(Boolean);
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ export async function CSVArray(values_csv: string): Promise<Array<string>> {
return value
.trim()
.replace(/^["']|["']$|(?<==)["']/g, '')
.replace(/=(.*[?{}|&~![()^]+.*)/, "='$1'");
.replace(/=(((?!E_).)*[?{}|&~![()^]+((?!E_).)+)/, "='$1'");
})
.filter(Boolean);
}
Expand Down

0 comments on commit 1686147

Please sign in to comment.