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