ts-sql-query
Advanced tools
Comparing version 1.32.0 to 1.33.0
@@ -424,6 +424,9 @@ "use strict"; | ||
if (typeof value === 'string') { | ||
const result = +value; | ||
if (isNaN(result)) { | ||
if (!/^(-?\d+)$/g.test(value)) { | ||
throw new Error('Invalid int value received from the db: ' + value); | ||
} | ||
const result = +value; | ||
if (!Number.isSafeInteger(result)) { | ||
throw new Error('Unnoticed precition lost transforming a string to int number. Value: ' + value); | ||
} | ||
return result; | ||
@@ -484,6 +487,6 @@ } | ||
if (typeof value === 'string') { | ||
const result = +value; | ||
if (result + '' !== value) { // Here the comparation is not isNaN(result) because NaN is a valid value as well Infinity and -Infinity | ||
if (!/^(-?\d+(\.\d+)?|NaN|-?Infinity)$/g.test(value)) { | ||
throw new Error('Invalid double value received from the db: ' + value); | ||
} | ||
const result = +value; | ||
return result; | ||
@@ -490,0 +493,0 @@ } |
{ | ||
"name": "ts-sql-query", | ||
"version": "1.32.0", | ||
"version": "1.33.0", | ||
"description": "Type-safe SQL query builder like QueryDSL or JOOQ in Java or Linq in .Net for TypeScript with MariaDB, MySql, Oracle, PostgreSql, Sqlite and SqlServer support.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
1918871
32296