1 | function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | export function isNumber(x) {
|
17 | return typeof x === 'number';
|
18 | }
|
19 | export function isBigNumber(x) {
|
20 | return x && x.constructor.prototype.isBigNumber === true || false;
|
21 | }
|
22 | export function isComplex(x) {
|
23 | return x && _typeof(x) === 'object' && Object.getPrototypeOf(x).isComplex === true || false;
|
24 | }
|
25 | export function isFraction(x) {
|
26 | return x && _typeof(x) === 'object' && Object.getPrototypeOf(x).isFraction === true || false;
|
27 | }
|
28 | export function isUnit(x) {
|
29 | return x && x.constructor.prototype.isUnit === true || false;
|
30 | }
|
31 | export function isString(x) {
|
32 | return typeof x === 'string';
|
33 | }
|
34 | export var isArray = Array.isArray;
|
35 | export function isMatrix(x) {
|
36 | return x && x.constructor.prototype.isMatrix === true || false;
|
37 | }
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 | export function isCollection(x) {
|
45 | return Array.isArray(x) || isMatrix(x);
|
46 | }
|
47 | export function isDenseMatrix(x) {
|
48 | return x && x.isDenseMatrix && x.constructor.prototype.isMatrix === true || false;
|
49 | }
|
50 | export function isSparseMatrix(x) {
|
51 | return x && x.isSparseMatrix && x.constructor.prototype.isMatrix === true || false;
|
52 | }
|
53 | export function isRange(x) {
|
54 | return x && x.constructor.prototype.isRange === true || false;
|
55 | }
|
56 | export function isIndex(x) {
|
57 | return x && x.constructor.prototype.isIndex === true || false;
|
58 | }
|
59 | export function isBoolean(x) {
|
60 | return typeof x === 'boolean';
|
61 | }
|
62 | export function isResultSet(x) {
|
63 | return x && x.constructor.prototype.isResultSet === true || false;
|
64 | }
|
65 | export function isHelp(x) {
|
66 | return x && x.constructor.prototype.isHelp === true || false;
|
67 | }
|
68 | export function isFunction(x) {
|
69 | return typeof x === 'function';
|
70 | }
|
71 | export function isDate(x) {
|
72 | return x instanceof Date;
|
73 | }
|
74 | export function isRegExp(x) {
|
75 | return x instanceof RegExp;
|
76 | }
|
77 | export function isObject(x) {
|
78 | return !!(x && _typeof(x) === 'object' && x.constructor === Object && !isComplex(x) && !isFraction(x));
|
79 | }
|
80 | export function isNull(x) {
|
81 | return x === null;
|
82 | }
|
83 | export function isUndefined(x) {
|
84 | return x === undefined;
|
85 | }
|
86 | export function isAccessorNode(x) {
|
87 | return x && x.isAccessorNode === true && x.constructor.prototype.isNode === true || false;
|
88 | }
|
89 | export function isArrayNode(x) {
|
90 | return x && x.isArrayNode === true && x.constructor.prototype.isNode === true || false;
|
91 | }
|
92 | export function isAssignmentNode(x) {
|
93 | return x && x.isAssignmentNode === true && x.constructor.prototype.isNode === true || false;
|
94 | }
|
95 | export function isBlockNode(x) {
|
96 | return x && x.isBlockNode === true && x.constructor.prototype.isNode === true || false;
|
97 | }
|
98 | export function isConditionalNode(x) {
|
99 | return x && x.isConditionalNode === true && x.constructor.prototype.isNode === true || false;
|
100 | }
|
101 | export function isConstantNode(x) {
|
102 | return x && x.isConstantNode === true && x.constructor.prototype.isNode === true || false;
|
103 | }
|
104 | export function isFunctionAssignmentNode(x) {
|
105 | return x && x.isFunctionAssignmentNode === true && x.constructor.prototype.isNode === true || false;
|
106 | }
|
107 | export function isFunctionNode(x) {
|
108 | return x && x.isFunctionNode === true && x.constructor.prototype.isNode === true || false;
|
109 | }
|
110 | export function isIndexNode(x) {
|
111 | return x && x.isIndexNode === true && x.constructor.prototype.isNode === true || false;
|
112 | }
|
113 | export function isNode(x) {
|
114 | return x && x.isNode === true && x.constructor.prototype.isNode === true || false;
|
115 | }
|
116 | export function isObjectNode(x) {
|
117 | return x && x.isObjectNode === true && x.constructor.prototype.isNode === true || false;
|
118 | }
|
119 | export function isOperatorNode(x) {
|
120 | return x && x.isOperatorNode === true && x.constructor.prototype.isNode === true || false;
|
121 | }
|
122 | export function isParenthesisNode(x) {
|
123 | return x && x.isParenthesisNode === true && x.constructor.prototype.isNode === true || false;
|
124 | }
|
125 | export function isRangeNode(x) {
|
126 | return x && x.isRangeNode === true && x.constructor.prototype.isNode === true || false;
|
127 | }
|
128 | export function isSymbolNode(x) {
|
129 | return x && x.isSymbolNode === true && x.constructor.prototype.isNode === true || false;
|
130 | }
|
131 | export function isChain(x) {
|
132 | return x && x.constructor.prototype.isChain === true || false;
|
133 | }
|
134 | export function typeOf(x) {
|
135 | var t = _typeof(x);
|
136 |
|
137 | if (t === 'object') {
|
138 |
|
139 | if (x === null) return 'null';
|
140 | if (Array.isArray(x)) return 'Array';
|
141 | if (x instanceof Date) return 'Date';
|
142 | if (x instanceof RegExp) return 'RegExp';
|
143 |
|
144 | if (isBigNumber(x)) return 'BigNumber';
|
145 | if (isComplex(x)) return 'Complex';
|
146 | if (isFraction(x)) return 'Fraction';
|
147 | if (isMatrix(x)) return 'Matrix';
|
148 | if (isUnit(x)) return 'Unit';
|
149 | if (isIndex(x)) return 'Index';
|
150 | if (isRange(x)) return 'Range';
|
151 | if (isResultSet(x)) return 'ResultSet';
|
152 | if (isNode(x)) return x.type;
|
153 | if (isChain(x)) return 'Chain';
|
154 | if (isHelp(x)) return 'Help';
|
155 | return 'Object';
|
156 | }
|
157 |
|
158 | if (t === 'function') return 'Function';
|
159 | return t;
|
160 | } |
\ | No newline at end of file |