Do not quote ini values with error constants

This commit is contained in:
Shivam Mathur 2021-02-04 13:01:05 +05:30
parent ecc8611061
commit 1686147b24
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
3 changed files with 5 additions and 2 deletions

View File

@ -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([]);
});

2
dist/index.js vendored
View File

@ -1285,7 +1285,7 @@ async function CSVArray(values_csv) {
return value
.trim()
.replace(/^["']|["']$|(?<==)["']/g, '')
.replace(/=(.*[?{}|&~![()^]+.*)/, "='$1'");
.replace(/=(((?!E_).)*[?{}|&~![()^]+((?!E_).)+)/, "='$1'");
})
.filter(Boolean);
}

View File

@ -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);
}