@@ -233,18 +233,18 @@ export default class AdminForthBaseConnector implements IAdminForthDataSourceCon
233233 // Float
234234 if ( field . type === AdminForthDataTypes . FLOAT ) {
235235 if ( value === "" || value === null ) return this . setFieldValue ( field , null ) ;
236- const n =
236+ const number =
237237 typeof value === "number"
238238 ? value
239239 : ( typeof value === "object" && value !== null ? ( value as any ) . valueOf ( ) : NaN ) ;
240240
241- if ( typeof n !== "number" || ! Number . isFinite ( n ) ) {
241+ if ( typeof number !== "number" || ! Number . isFinite ( number ) ) {
242242 throw new Error (
243243 `Value is not a float. Field ${ field . name } with type is ${ field . type } , but got value: ${ String ( value ) } with type ${ typeof value } `
244244 ) ;
245245 }
246246
247- return this . setFieldValue ( field , n ) ;
247+ return this . setFieldValue ( field , number ) ;
248248 }
249249
250250 // Decimal
@@ -259,21 +259,20 @@ export default class AdminForthBaseConnector implements IAdminForthDataSourceCon
259259 }
260260
261261 if ( typeof value === "string" ) {
262- const s = value . trim ( ) ;
263- if ( ! s ) return this . setFieldValue ( field , null ) ;
264- if ( Number . isFinite ( Number ( s ) ) ) return this . setFieldValue ( field , s ) ;
262+ const string = value . trim ( ) ;
263+ if ( ! string ) return this . setFieldValue ( field , null ) ;
264+ if ( Number . isFinite ( Number ( string ) ) ) return this . setFieldValue ( field , string ) ;
265265 throw new Error ( `Value is not a decimal. Field ${ field . name } got: ${ value } (string)` ) ;
266266 }
267267
268268 if ( typeof value === "object" && value ) {
269- const v : any = value ;
270- if ( typeof v . toString !== "function" ) {
269+ if ( typeof value . toString !== "function" ) {
271270 throw new Error ( `Decimal object has no toString(). Field ${ field . name } got: ${ String ( value ) } ` ) ;
272271 }
273- const s = v . toString ( ) . trim ( ) ;
274- if ( ! s ) return this . setFieldValue ( field , null ) ;
275- if ( Number . isFinite ( Number ( s ) ) ) return this . setFieldValue ( field , s ) ;
276- throw new Error ( `Value is not a decimal. Field ${ field . name } got: ${ s } (object->string)` ) ;
272+ const string = value . toString ( ) . trim ( ) ;
273+ if ( ! string ) return this . setFieldValue ( field , null ) ;
274+ if ( Number . isFinite ( Number ( string ) ) ) return this . setFieldValue ( field , string ) ;
275+ throw new Error ( `Value is not a decimal. Field ${ field . name } got: ${ string } (object->string)` ) ;
277276 }
278277
279278 throw new Error ( `Value is not a decimal. Field ${ field . name } got: ${ String ( value ) } (${ typeof value } )` ) ;
0 commit comments