Projekt

Obecné

Profil

Stáhnout (723 Bajtů) Statistiky
| Větev: | Revize:
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;
(404-404/590)