source: trip-planner-front/node_modules/core-util-is/lib/util.js

Last change on this file was e29cc2e, checked in by Ema <ema_spirova@…>, 3 years ago

primeNG components

  • Property mode set to 100644
File size: 3.0 KB
Line 
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
25function isArray(arg) {
26 if (Array.isArray) {
27 return Array.isArray(arg);
28 }
29 return objectToString(arg) === '[object Array]';
30}
31exports.isArray = isArray;
32
33function isBoolean(arg) {
34 return typeof arg === 'boolean';
35}
36exports.isBoolean = isBoolean;
37
38function isNull(arg) {
39 return arg === null;
40}
41exports.isNull = isNull;
42
43function isNullOrUndefined(arg) {
44 return arg == null;
45}
46exports.isNullOrUndefined = isNullOrUndefined;
47
48function isNumber(arg) {
49 return typeof arg === 'number';
50}
51exports.isNumber = isNumber;
52
53function isString(arg) {
54 return typeof arg === 'string';
55}
56exports.isString = isString;
57
58function isSymbol(arg) {
59 return typeof arg === 'symbol';
60}
61exports.isSymbol = isSymbol;
62
63function isUndefined(arg) {
64 return arg === void 0;
65}
66exports.isUndefined = isUndefined;
67
68function isRegExp(re) {
69 return objectToString(re) === '[object RegExp]';
70}
71exports.isRegExp = isRegExp;
72
73function isObject(arg) {
74 return typeof arg === 'object' && arg !== null;
75}
76exports.isObject = isObject;
77
78function isDate(d) {
79 return objectToString(d) === '[object Date]';
80}
81exports.isDate = isDate;
82
83function isError(e) {
84 return (objectToString(e) === '[object Error]' || e instanceof Error);
85}
86exports.isError = isError;
87
88function isFunction(arg) {
89 return typeof arg === 'function';
90}
91exports.isFunction = isFunction;
92
93function isPrimitive(arg) {
94 return arg === null ||
95 typeof arg === 'boolean' ||
96 typeof arg === 'number' ||
97 typeof arg === 'string' ||
98 typeof arg === 'symbol' || // ES6 symbol
99 typeof arg === 'undefined';
100}
101exports.isPrimitive = isPrimitive;
102
103exports.isBuffer = require('buffer').Buffer.isBuffer;
104
105function objectToString(o) {
106 return Object.prototype.toString.call(o);
107}
Note: See TracBrowser for help on using the repository browser.