/**
* 检查`value`是否为字符串
* Checks if `value` is classified as a `String` primitive or object.
* @param {*} value The value to check
* @returns {boolean} Returns `true` if `value` is a string, else `false`
* @example
*
* isString('1')
* // => true
*
* isString(new String('1'))
* // => true
*
* isString(1)
* // => false
*/
const stringTag = "[object String]"
function isObjectLike(value) {
return typeof value == "object" && value !== null;
}
function isString(value) {
return (
typeof value === "string" ||
(isObjectLike(value) && Object.prototype.toString.call(value) === stringTag)
)
}
export default isString