Last change
on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
580 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | var baseToString = require('./_baseToString');
|
---|
| 2 |
|
---|
| 3 | /**
|
---|
| 4 | * Converts `value` to a string. An empty string is returned for `null`
|
---|
| 5 | * and `undefined` values. The sign of `-0` is preserved.
|
---|
| 6 | *
|
---|
| 7 | * @static
|
---|
| 8 | * @memberOf _
|
---|
| 9 | * @since 4.0.0
|
---|
| 10 | * @category Lang
|
---|
| 11 | * @param {*} value The value to convert.
|
---|
| 12 | * @returns {string} Returns the converted string.
|
---|
| 13 | * @example
|
---|
| 14 | *
|
---|
| 15 | * _.toString(null);
|
---|
| 16 | * // => ''
|
---|
| 17 | *
|
---|
| 18 | * _.toString(-0);
|
---|
| 19 | * // => '-0'
|
---|
| 20 | *
|
---|
| 21 | * _.toString([1, 2, 3]);
|
---|
| 22 | * // => '1,2,3'
|
---|
| 23 | */
|
---|
| 24 | function toString(value) {
|
---|
| 25 | return value == null ? '' : baseToString(value);
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | module.exports = toString;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.