@@ -69,7 +69,9 @@ public static object ObjectStringToType(ReadOnlySpan<char> strType)
6969 return propertyValue ;
7070 }
7171
72- if ( JsConfig . ConvertObjectTypesIntoStringDictionary && ! strType . IsNullOrEmpty ( ) )
72+ var config = JsConfig . GetConfig ( ) ;
73+
74+ if ( config . ConvertObjectTypesIntoStringDictionary && ! strType . IsNullOrEmpty ( ) )
7375 {
7476 if ( strType [ 0 ] == JsWriter . MapStartChar )
7577 {
@@ -86,7 +88,7 @@ public static object ObjectStringToType(ReadOnlySpan<char> strType)
8688 }
8789 }
8890
89- var primitiveType = JsConfig . TryToParsePrimitiveTypeValues ? ParsePrimitive ( strType ) : null ;
91+ var primitiveType = config . TryToParsePrimitiveTypeValues ? ParsePrimitive ( strType ) : null ;
9092 if ( primitiveType != null )
9193 return primitiveType ;
9294
@@ -156,7 +158,8 @@ public static object ParseAbstractType<T>(ReadOnlySpan<char> value)
156158
157159 public static object ParseQuotedPrimitive ( string value )
158160 {
159- var fn = JsConfig . ParsePrimitiveFn ;
161+ var config = JsConfig . GetConfig ( ) ;
162+ var fn = config . ParsePrimitiveFn ;
160163 var result = fn ? . Invoke ( value ) ;
161164 if ( result != null )
162165 return result ;
@@ -184,7 +187,7 @@ public static object ParseQuotedPrimitive(string value)
184187 }
185188 }
186189
187- if ( JsConfig . DateHandler == DateHandler . RFC1123 )
190+ if ( config . DateHandler == DateHandler . RFC1123 )
188191 {
189192 // check that we have RFC1123 date:
190193 // ddd, dd MMM yyyy HH:mm:ss GMT
@@ -407,15 +410,17 @@ public static object ParseNumber(this ReadOnlySpan<char> value, bool bestFit)
407410 }
408411 }
409412
413+ var config = JsConfig . GetConfig ( ) ;
414+
410415 // Parse as decimal
411- var acceptDecimal = JsConfig . ParsePrimitiveFloatingPointTypes . Has ( ParseAsType . Decimal ) ;
416+ var acceptDecimal = config . ParsePrimitiveFloatingPointTypes . Has ( ParseAsType . Decimal ) ;
412417 var isDecimal = value . TryParseDecimal ( out decimal decimalValue ) ;
413418
414419 // Check if the number is an Primitive Integer type given that we have a decimal
415420 if ( isDecimal && decimalValue == decimal . Truncate ( decimalValue ) )
416421 {
417422 // Value is a whole number
418- var parseAs = JsConfig . ParsePrimitiveIntegerTypes ;
423+ var parseAs = config . ParsePrimitiveIntegerTypes ;
419424 if ( parseAs . Has ( ParseAsType . Byte ) && decimalValue <= byte . MaxValue && decimalValue >= byte . MinValue )
420425 return ( byte ) decimalValue ;
421426 if ( parseAs . Has ( ParseAsType . SByte ) && decimalValue <= sbyte . MaxValue && decimalValue >= sbyte . MinValue )
@@ -441,12 +446,12 @@ public static object ParseNumber(this ReadOnlySpan<char> value, bool bestFit)
441446 if ( isDecimal && acceptDecimal )
442447 return decimalValue ;
443448
444- var acceptFloat = JsConfig . ParsePrimitiveFloatingPointTypes . HasFlag ( ParseAsType . Single ) ;
449+ var acceptFloat = config . ParsePrimitiveFloatingPointTypes . HasFlag ( ParseAsType . Single ) ;
445450 var isFloat = value . TryParseFloat ( out float floatValue ) ;
446451 if ( acceptFloat && isFloat )
447452 return floatValue ;
448453
449- var acceptDouble = JsConfig . ParsePrimitiveFloatingPointTypes . HasFlag ( ParseAsType . Double ) ;
454+ var acceptDouble = config . ParsePrimitiveFloatingPointTypes . HasFlag ( ParseAsType . Double ) ;
450455 var isDouble = value . TryParseDouble ( out double doubleValue ) ;
451456 if ( acceptDouble && isDouble )
452457 return doubleValue ;
0 commit comments