chore: check string first in toDisplayString

This commit is contained in:
Evan You 2022-01-30 18:50:28 +08:00
parent 81a6708739
commit bb43704b64

View File

@ -5,7 +5,8 @@ import {
isFunction,
isPlainObject,
isSet,
objectToString
objectToString,
isString
} from './index'
/**
@ -13,7 +14,9 @@ import {
* @private
*/
export const toDisplayString = (val: unknown): string => {
return val == null
return isString(val)
? val
: val == null
? ''
: isArray(val) ||
(isObject(val) &&