nv-constexpr-simple-codify 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +12 -18
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -215,6 +215,18 @@ function is_supported(o, rtrn_pair = true, seen = new WeakSet()) {
|
|
|
215
215
|
seen.add(o);
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
+
// 7. 支持的基础类型
|
|
219
|
+
if (
|
|
220
|
+
o === undefined ||
|
|
221
|
+
o === null ||
|
|
222
|
+
typeof o === 'boolean' ||
|
|
223
|
+
typeof o === 'string' ||
|
|
224
|
+
typeof o === 'number' ||
|
|
225
|
+
typeof o === 'bigint'
|
|
226
|
+
) {
|
|
227
|
+
return rtrn_pair ? [true, null] : true;
|
|
228
|
+
}
|
|
229
|
+
|
|
218
230
|
// 2. 排除 Symbol
|
|
219
231
|
if (typeof o === 'symbol') {
|
|
220
232
|
return rtrn_pair ? [false, "Symbol is not supported"] : false;
|
|
@@ -240,18 +252,6 @@ function is_supported(o, rtrn_pair = true, seen = new WeakSet()) {
|
|
|
240
252
|
return rtrn_pair ? [false, "Iterator is not supported"] : false;
|
|
241
253
|
}
|
|
242
254
|
|
|
243
|
-
// 7. 支持的基础类型
|
|
244
|
-
if (
|
|
245
|
-
o === undefined ||
|
|
246
|
-
o === null ||
|
|
247
|
-
typeof o === 'boolean' ||
|
|
248
|
-
typeof o === 'string' ||
|
|
249
|
-
typeof o === 'number' ||
|
|
250
|
-
typeof o === 'bigint'
|
|
251
|
-
) {
|
|
252
|
-
return rtrn_pair ? [true, null] : true;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
255
|
// 8. 支持的特殊对象类型
|
|
256
256
|
if (o instanceof Date) {
|
|
257
257
|
return rtrn_pair ? [true, null] : true;
|
|
@@ -312,12 +312,6 @@ function is_supported(o, rtrn_pair = true, seen = new WeakSet()) {
|
|
|
312
312
|
return rtrn_pair ? [false, "Set/Map/WeakMap/WeakSet/WeakRef is not supported"] : false;
|
|
313
313
|
}
|
|
314
314
|
|
|
315
|
-
// 检查是否是普通对象(plain object)
|
|
316
|
-
const proto = Object.getPrototypeOf(o);
|
|
317
|
-
if (proto !== Object.prototype && proto !== null) {
|
|
318
|
-
return rtrn_pair ? [false, "Custom class instance is not supported (only plain objects)"] : false;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
315
|
// 递归检查每个属性值
|
|
322
316
|
for (const key in o) {
|
|
323
317
|
const res = is_supported(o[key], rtrn_pair, seen);
|