diff --git a/src/controllers/syncController.ts b/src/controllers/syncController.ts index fdb7e8c..5c25332 100644 --- a/src/controllers/syncController.ts +++ b/src/controllers/syncController.ts @@ -143,10 +143,19 @@ async function processDatabaseSync(database: any) { }); for (const op of ops) { + const removeSpace = (string: string) => { + return string + .replace( + /[\s\u00A0\u1680\u2000-\u200F\u2028\u2029\u202F\u205F\u3000\uFEFF]/g, + " " + ) + .replace(/\s+/g, " ") + .trim(); + }; const existData = existingRecords.find( (record) => - JSON.stringify(record.c_invoice_id) === - JSON.stringify(op.c_invoice_id) + removeSpace(JSON.stringify(record.c_invoice_id)) === + removeSpace(JSON.stringify(op.c_invoice_id)) ); const existingId = existData ? existData.id : null; if (existingId) {