mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 08:37:49 +00:00
wip: migrate to bun
This commit is contained in:
29
src/isString.ts
Normal file
29
src/isString.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import getTag from './.internal/getTag.js';
|
||||
|
||||
/**
|
||||
* Checks if `value` is classified as a `String` primitive or object.
|
||||
*
|
||||
* @since 0.1.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is a string, else `false`.
|
||||
* @example
|
||||
*
|
||||
* isString('abc')
|
||||
* // => true
|
||||
*
|
||||
* isString(1)
|
||||
* // => false
|
||||
*/
|
||||
function isString(value) {
|
||||
const type = typeof value;
|
||||
return (
|
||||
type === 'string' ||
|
||||
(type === 'object' &&
|
||||
value != null &&
|
||||
!Array.isArray(value) &&
|
||||
getTag(value) == '[object String]')
|
||||
);
|
||||
}
|
||||
|
||||
export default isString;
|
||||
Reference in New Issue
Block a user