mirror of
https://github.com/typicode/json-server.git
synced 2026-03-13 09:35:37 +08:00
refactor: clarify blank-string handling in where coercion
This commit is contained in:
@@ -38,8 +38,10 @@ function coerceValue(value: string): string | number | boolean | null {
|
||||
if (value === 'false') return false
|
||||
if (value === 'null') return null
|
||||
|
||||
if (value.trim() === '') return value
|
||||
|
||||
const num = Number(value)
|
||||
if (Number.isFinite(num) && value.trim() !== '') return num
|
||||
if (Number.isFinite(num)) return num
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user