mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
fix(Grist Node): Test for integer precision loss (#17136)
Co-authored-by: Jonathan Bennetts <jonathan.bennetts@gmail.com>
This commit is contained in:
@@ -67,10 +67,14 @@ export function parseSortProperties(sortProperties: GristSortProperties) {
|
||||
}, '');
|
||||
}
|
||||
|
||||
export function isSafeInteger(val: number) {
|
||||
return !isNaN(val) && val > Number.MIN_VALUE && val < Number.MAX_VALUE;
|
||||
}
|
||||
|
||||
export function parseFilterProperties(filterProperties: GristFilterProperties) {
|
||||
return filterProperties.reduce<{ [key: string]: Array<string | number> }>((acc, cur) => {
|
||||
acc[cur.field] = acc[cur.field] ?? [];
|
||||
const values = isNaN(Number(cur.values)) ? cur.values : Number(cur.values);
|
||||
const values = isSafeInteger(Number(cur.values)) ? Number(cur.values) : cur.values;
|
||||
acc[cur.field].push(values);
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
Reference in New Issue
Block a user