Last change
on this file since ceaed42 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
723 bytes
|
Line | |
---|
1 | var baseGetTag = require('./_baseGetTag'),
|
---|
2 | isArray = require('./isArray'),
|
---|
3 | isObjectLike = require('./isObjectLike');
|
---|
4 |
|
---|
5 | /** `Object#toString` result references. */
|
---|
6 | var stringTag = '[object String]';
|
---|
7 |
|
---|
8 | /**
|
---|
9 | * Checks if `value` is classified as a `String` primitive or object.
|
---|
10 | *
|
---|
11 | * @static
|
---|
12 | * @since 0.1.0
|
---|
13 | * @memberOf _
|
---|
14 | * @category Lang
|
---|
15 | * @param {*} value The value to check.
|
---|
16 | * @returns {boolean} Returns `true` if `value` is a string, else `false`.
|
---|
17 | * @example
|
---|
18 | *
|
---|
19 | * _.isString('abc');
|
---|
20 | * // => true
|
---|
21 | *
|
---|
22 | * _.isString(1);
|
---|
23 | * // => false
|
---|
24 | */
|
---|
25 | function isString(value) {
|
---|
26 | return typeof value == 'string' ||
|
---|
27 | (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
|
---|
28 | }
|
---|
29 |
|
---|
30 | module.exports = isString;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.