From 1c529a8318f260d31f527ccf47fde4c96f8b4155 Mon Sep 17 00:00:00 2001 From: Giuseppe Riolo Date: Mon, 11 Oct 2021 15:26:54 +0200 Subject: [PATCH 1/2] regex fix for unicode & single quote char support --- src/lib.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lib.ts b/src/lib.ts index c68525f..e619396 100644 --- a/src/lib.ts +++ b/src/lib.ts @@ -24,9 +24,10 @@ export const mapCss = (data: any, debug?: boolean): object => { }; export const cleanValue = (val: string): string | void => { - const matches = val.match(/content\s*:\s*"\\f([^"]+)"/i); - if (matches) { - return `\\uf${matches[1]}`; + const _v = val.replace(/(content\s*:\s*("|'))/, '').replace(/(("|');*)/, '').trim() + if (_v.length === 1) { + return _v + } else { + return `\\u${_v.substring(1)}` } - return void 0; }; From 5e9df653b5e104565c3122ea5c5c2beaad4e8fcc Mon Sep 17 00:00:00 2001 From: Giuseppe Riolo Date: Mon, 11 Oct 2021 15:44:25 +0200 Subject: [PATCH 2/2] fix unicode control --- src/lib.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.ts b/src/lib.ts index e619396..9b18739 100644 --- a/src/lib.ts +++ b/src/lib.ts @@ -25,7 +25,7 @@ export const mapCss = (data: any, debug?: boolean): object => { export const cleanValue = (val: string): string | void => { const _v = val.replace(/(content\s*:\s*("|'))/, '').replace(/(("|');*)/, '').trim() - if (_v.length === 1) { + if (_v.includes('u')) { return _v } else { return `\\u${_v.substring(1)}`