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