]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.tostring/index.js
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / node_modules / npmlog / node_modules / gauge / node_modules / lodash.tostring / index.js
1 /**
2  * lodash (Custom Build) <https://lodash.com/>
3  * Build: `lodash modularize exports="npm" -o ./`
4  * Copyright jQuery Foundation and other contributors <https://jquery.org/>
5  * Released under MIT license <https://lodash.com/license>
6  * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
7  * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
8  */
9
10 /** Used as references for various `Number` constants. */
11 var INFINITY = 1 / 0;
12
13 /** `Object#toString` result references. */
14 var symbolTag = '[object Symbol]';
15
16 /** Detect free variable `global` from Node.js. */
17 var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
18
19 /** Detect free variable `self`. */
20 var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
21
22 /** Used as a reference to the global object. */
23 var root = freeGlobal || freeSelf || Function('return this')();
24
25 /** Used for built-in method references. */
26 var objectProto = Object.prototype;
27
28 /**
29  * Used to resolve the
30  * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
31  * of values.
32  */
33 var objectToString = objectProto.toString;
34
35 /** Built-in value references. */
36 var Symbol = root.Symbol;
37
38 /** Used to convert symbols to primitives and strings. */
39 var symbolProto = Symbol ? Symbol.prototype : undefined,
40     symbolToString = symbolProto ? symbolProto.toString : undefined;
41
42 /**
43  * The base implementation of `_.toString` which doesn't convert nullish
44  * values to empty strings.
45  *
46  * @private
47  * @param {*} value The value to process.
48  * @returns {string} Returns the string.
49  */
50 function baseToString(value) {
51   // Exit early for strings to avoid a performance hit in some environments.
52   if (typeof value == 'string') {
53     return value;
54   }
55   if (isSymbol(value)) {
56     return symbolToString ? symbolToString.call(value) : '';
57   }
58   var result = (value + '');
59   return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
60 }
61
62 /**
63  * Checks if `value` is object-like. A value is object-like if it's not `null`
64  * and has a `typeof` result of "object".
65  *
66  * @static
67  * @memberOf _
68  * @since 4.0.0
69  * @category Lang
70  * @param {*} value The value to check.
71  * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
72  * @example
73  *
74  * _.isObjectLike({});
75  * // => true
76  *
77  * _.isObjectLike([1, 2, 3]);
78  * // => true
79  *
80  * _.isObjectLike(_.noop);
81  * // => false
82  *
83  * _.isObjectLike(null);
84  * // => false
85  */
86 function isObjectLike(value) {
87   return !!value && typeof value == 'object';
88 }
89
90 /**
91  * Checks if `value` is classified as a `Symbol` primitive or object.
92  *
93  * @static
94  * @memberOf _
95  * @since 4.0.0
96  * @category Lang
97  * @param {*} value The value to check.
98  * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
99  * @example
100  *
101  * _.isSymbol(Symbol.iterator);
102  * // => true
103  *
104  * _.isSymbol('abc');
105  * // => false
106  */
107 function isSymbol(value) {
108   return typeof value == 'symbol' ||
109     (isObjectLike(value) && objectToString.call(value) == symbolTag);
110 }
111
112 /**
113  * Converts `value` to a string. An empty string is returned for `null`
114  * and `undefined` values. The sign of `-0` is preserved.
115  *
116  * @static
117  * @memberOf _
118  * @since 4.0.0
119  * @category Lang
120  * @param {*} value The value to process.
121  * @returns {string} Returns the string.
122  * @example
123  *
124  * _.toString(null);
125  * // => ''
126  *
127  * _.toString(-0);
128  * // => '-0'
129  *
130  * _.toString([1, 2, 3]);
131  * // => '1,2,3'
132  */
133 function toString(value) {
134   return value == null ? '' : baseToString(value);
135 }
136
137 module.exports = toString;