]> 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._basetostring/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._basetostring / 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 /** Used to determine if values are of the language type `Object`. */
17 var objectTypes = {
18   'function': true,
19   'object': true
20 };
21
22 /** Detect free variable `exports`. */
23 var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType)
24   ? exports
25   : undefined;
26
27 /** Detect free variable `module`. */
28 var freeModule = (objectTypes[typeof module] && module && !module.nodeType)
29   ? module
30   : undefined;
31
32 /** Detect free variable `global` from Node.js. */
33 var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global);
34
35 /** Detect free variable `self`. */
36 var freeSelf = checkGlobal(objectTypes[typeof self] && self);
37
38 /** Detect free variable `window`. */
39 var freeWindow = checkGlobal(objectTypes[typeof window] && window);
40
41 /** Detect `this` as the global object. */
42 var thisGlobal = checkGlobal(objectTypes[typeof this] && this);
43
44 /**
45  * Used as a reference to the global object.
46  *
47  * The `this` value is used if it's the global object to avoid Greasemonkey's
48  * restricted `window` object, otherwise the `window` object is used.
49  */
50 var root = freeGlobal ||
51   ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) ||
52     freeSelf || thisGlobal || Function('return this')();
53
54 /**
55  * Checks if `value` is a global object.
56  *
57  * @private
58  * @param {*} value The value to check.
59  * @returns {null|Object} Returns `value` if it's a global object, else `null`.
60  */
61 function checkGlobal(value) {
62   return (value && value.Object === Object) ? value : null;
63 }
64
65 /** Used for built-in method references. */
66 var objectProto = Object.prototype;
67
68 /**
69  * Used to resolve the
70  * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
71  * of values.
72  */
73 var objectToString = objectProto.toString;
74
75 /** Built-in value references. */
76 var Symbol = root.Symbol;
77
78 /** Used to convert symbols to primitives and strings. */
79 var symbolProto = Symbol ? Symbol.prototype : undefined,
80     symbolToString = symbolProto ? symbolProto.toString : undefined;
81
82 /**
83  * The base implementation of `_.toString` which doesn't convert nullish
84  * values to empty strings.
85  *
86  * @private
87  * @param {*} value The value to process.
88  * @returns {string} Returns the string.
89  */
90 function baseToString(value) {
91   // Exit early for strings to avoid a performance hit in some environments.
92   if (typeof value == 'string') {
93     return value;
94   }
95   if (isSymbol(value)) {
96     return symbolToString ? symbolToString.call(value) : '';
97   }
98   var result = (value + '');
99   return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
100 }
101
102 /**
103  * Checks if `value` is object-like. A value is object-like if it's not `null`
104  * and has a `typeof` result of "object".
105  *
106  * @static
107  * @memberOf _
108  * @since 4.0.0
109  * @category Lang
110  * @param {*} value The value to check.
111  * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
112  * @example
113  *
114  * _.isObjectLike({});
115  * // => true
116  *
117  * _.isObjectLike([1, 2, 3]);
118  * // => true
119  *
120  * _.isObjectLike(_.noop);
121  * // => false
122  *
123  * _.isObjectLike(null);
124  * // => false
125  */
126 function isObjectLike(value) {
127   return !!value && typeof value == 'object';
128 }
129
130 /**
131  * Checks if `value` is classified as a `Symbol` primitive or object.
132  *
133  * @static
134  * @memberOf _
135  * @since 4.0.0
136  * @category Lang
137  * @param {*} value The value to check.
138  * @returns {boolean} Returns `true` if `value` is correctly classified,
139  *  else `false`.
140  * @example
141  *
142  * _.isSymbol(Symbol.iterator);
143  * // => true
144  *
145  * _.isSymbol('abc');
146  * // => false
147  */
148 function isSymbol(value) {
149   return typeof value == 'symbol' ||
150     (isObjectLike(value) && objectToString.call(value) == symbolTag);
151 }
152
153 module.exports = baseToString;