]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/sha/node_modules/readable-stream/node_modules/core-util-is/lib/util.js
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / node_modules / sha / node_modules / readable-stream / node_modules / core-util-is / lib / util.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 // NOTE: These type checking functions intentionally don't use `instanceof`
23 // because it is fragile and can be easily faked with `Object.create()`.
24 function isArray(ar) {
25   return Array.isArray(ar);
26 }
27 exports.isArray = isArray;
28
29 function isBoolean(arg) {
30   return typeof arg === 'boolean';
31 }
32 exports.isBoolean = isBoolean;
33
34 function isNull(arg) {
35   return arg === null;
36 }
37 exports.isNull = isNull;
38
39 function isNullOrUndefined(arg) {
40   return arg == null;
41 }
42 exports.isNullOrUndefined = isNullOrUndefined;
43
44 function isNumber(arg) {
45   return typeof arg === 'number';
46 }
47 exports.isNumber = isNumber;
48
49 function isString(arg) {
50   return typeof arg === 'string';
51 }
52 exports.isString = isString;
53
54 function isSymbol(arg) {
55   return typeof arg === 'symbol';
56 }
57 exports.isSymbol = isSymbol;
58
59 function isUndefined(arg) {
60   return arg === void 0;
61 }
62 exports.isUndefined = isUndefined;
63
64 function isRegExp(re) {
65   return isObject(re) && objectToString(re) === '[object RegExp]';
66 }
67 exports.isRegExp = isRegExp;
68
69 function isObject(arg) {
70   return typeof arg === 'object' && arg !== null;
71 }
72 exports.isObject = isObject;
73
74 function isDate(d) {
75   return isObject(d) && objectToString(d) === '[object Date]';
76 }
77 exports.isDate = isDate;
78
79 function isError(e) {
80   return isObject(e) &&
81       (objectToString(e) === '[object Error]' || e instanceof Error);
82 }
83 exports.isError = isError;
84
85 function isFunction(arg) {
86   return typeof arg === 'function';
87 }
88 exports.isFunction = isFunction;
89
90 function isPrimitive(arg) {
91   return arg === null ||
92          typeof arg === 'boolean' ||
93          typeof arg === 'number' ||
94          typeof arg === 'string' ||
95          typeof arg === 'symbol' ||  // ES6 symbol
96          typeof arg === 'undefined';
97 }
98 exports.isPrimitive = isPrimitive;
99
100 function isBuffer(arg) {
101   return Buffer.isBuffer(arg);
102 }
103 exports.isBuffer = isBuffer;
104
105 function objectToString(o) {
106   return Object.prototype.toString.call(o);
107 }