[fix] toPrimitive 空字符串转数字错误

This commit is contained in:
what 2024-08-09 17:57:03 +08:00
parent 51082bf78b
commit a43a286dfa

View File

@ -9,9 +9,9 @@ const convertFns = {
string2json: (data) => data ? JSON.parse(data) : '{}',
string2array: (data) => data.substr(0, 1) === '[' && data.substr(-1) === ']' ? JSON.parse(data) : data.split(','),
string2number: (data) => data == '' ? null : +data,
string2integer: (data) => data == '' ? null : +data,
string2float: (data) => data == '' ? null : +data,
string2number: (data) => data == '' ? 0 : +data,
string2integer: (data) => data == '' ? 0 : +data,
string2float: (data) => data == '' ? 0 : +data,
string2bool: (data) => {
switch (`${data}`.toLowerCase()) {
case '0':