jslike 1.8.1 → 1.8.2
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/dist/esm/errors/enhanced-error.js +37 -11
- package/dist/index.cjs +30 -9
- package/dist/index.d.cts +37 -11
- package/dist/index.d.ts +37 -11
- package/dist/index.js +30 -9
- package/package.json +1 -1
|
@@ -54,22 +54,48 @@ function getAvailableMethods(obj) {
|
|
|
54
54
|
|
|
55
55
|
const methods = new Set();
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
const addSafeMethods = (target, includeConstructor = true) => {
|
|
58
|
+
let names;
|
|
59
|
+
try {
|
|
60
|
+
names = Object.getOwnPropertyNames(target);
|
|
61
|
+
} catch {
|
|
62
|
+
return;
|
|
61
63
|
}
|
|
62
|
-
});
|
|
63
64
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
names.forEach(name => {
|
|
66
|
+
if (!includeConstructor && name === 'constructor') return;
|
|
67
|
+
|
|
68
|
+
let descriptor;
|
|
69
|
+
try {
|
|
70
|
+
descriptor = Object.getOwnPropertyDescriptor(target, name);
|
|
71
|
+
} catch {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (descriptor && 'value' in descriptor && typeof descriptor.value === 'function') {
|
|
69
76
|
methods.add(name);
|
|
70
77
|
}
|
|
71
78
|
});
|
|
72
|
-
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// Get own properties
|
|
82
|
+
addSafeMethods(obj);
|
|
83
|
+
|
|
84
|
+
// Get prototype methods
|
|
85
|
+
let proto;
|
|
86
|
+
try {
|
|
87
|
+
proto = Object.getPrototypeOf(obj);
|
|
88
|
+
} catch {
|
|
89
|
+
proto = null;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
while (proto && proto !== Object.prototype) {
|
|
93
|
+
addSafeMethods(proto, false);
|
|
94
|
+
try {
|
|
95
|
+
proto = Object.getPrototypeOf(proto);
|
|
96
|
+
} catch {
|
|
97
|
+
proto = null;
|
|
98
|
+
}
|
|
73
99
|
}
|
|
74
100
|
|
|
75
101
|
return Array.from(methods).sort();
|
package/dist/index.cjs
CHANGED
|
@@ -11425,19 +11425,40 @@ function findSimilar(target, candidates, maxDistance = 3) {
|
|
|
11425
11425
|
function getAvailableMethods(obj) {
|
|
11426
11426
|
if (obj === null || obj === void 0) return [];
|
|
11427
11427
|
const methods = /* @__PURE__ */ new Set();
|
|
11428
|
-
|
|
11429
|
-
|
|
11430
|
-
|
|
11428
|
+
const addSafeMethods = (target, includeConstructor = true) => {
|
|
11429
|
+
let names;
|
|
11430
|
+
try {
|
|
11431
|
+
names = Object.getOwnPropertyNames(target);
|
|
11432
|
+
} catch {
|
|
11433
|
+
return;
|
|
11431
11434
|
}
|
|
11432
|
-
|
|
11433
|
-
|
|
11434
|
-
|
|
11435
|
-
|
|
11436
|
-
|
|
11435
|
+
names.forEach((name) => {
|
|
11436
|
+
if (!includeConstructor && name === "constructor") return;
|
|
11437
|
+
let descriptor;
|
|
11438
|
+
try {
|
|
11439
|
+
descriptor = Object.getOwnPropertyDescriptor(target, name);
|
|
11440
|
+
} catch {
|
|
11441
|
+
return;
|
|
11442
|
+
}
|
|
11443
|
+
if (descriptor && "value" in descriptor && typeof descriptor.value === "function") {
|
|
11437
11444
|
methods.add(name);
|
|
11438
11445
|
}
|
|
11439
11446
|
});
|
|
11440
|
-
|
|
11447
|
+
};
|
|
11448
|
+
addSafeMethods(obj);
|
|
11449
|
+
let proto;
|
|
11450
|
+
try {
|
|
11451
|
+
proto = Object.getPrototypeOf(obj);
|
|
11452
|
+
} catch {
|
|
11453
|
+
proto = null;
|
|
11454
|
+
}
|
|
11455
|
+
while (proto && proto !== Object.prototype) {
|
|
11456
|
+
addSafeMethods(proto, false);
|
|
11457
|
+
try {
|
|
11458
|
+
proto = Object.getPrototypeOf(proto);
|
|
11459
|
+
} catch {
|
|
11460
|
+
proto = null;
|
|
11461
|
+
}
|
|
11441
11462
|
}
|
|
11442
11463
|
return Array.from(methods).sort();
|
|
11443
11464
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -12100,22 +12100,48 @@ function getAvailableMethods(obj) {
|
|
|
12100
12100
|
|
|
12101
12101
|
const methods = new Set();
|
|
12102
12102
|
|
|
12103
|
-
|
|
12104
|
-
|
|
12105
|
-
|
|
12106
|
-
|
|
12103
|
+
const addSafeMethods = (target, includeConstructor = true) => {
|
|
12104
|
+
let names;
|
|
12105
|
+
try {
|
|
12106
|
+
names = Object.getOwnPropertyNames(target);
|
|
12107
|
+
} catch {
|
|
12108
|
+
return;
|
|
12107
12109
|
}
|
|
12108
|
-
});
|
|
12109
12110
|
|
|
12110
|
-
|
|
12111
|
-
|
|
12112
|
-
|
|
12113
|
-
|
|
12114
|
-
|
|
12111
|
+
names.forEach(name => {
|
|
12112
|
+
if (!includeConstructor && name === 'constructor') return;
|
|
12113
|
+
|
|
12114
|
+
let descriptor;
|
|
12115
|
+
try {
|
|
12116
|
+
descriptor = Object.getOwnPropertyDescriptor(target, name);
|
|
12117
|
+
} catch {
|
|
12118
|
+
return;
|
|
12119
|
+
}
|
|
12120
|
+
|
|
12121
|
+
if (descriptor && 'value' in descriptor && typeof descriptor.value === 'function') {
|
|
12115
12122
|
methods.add(name);
|
|
12116
12123
|
}
|
|
12117
12124
|
});
|
|
12118
|
-
|
|
12125
|
+
};
|
|
12126
|
+
|
|
12127
|
+
// Get own properties
|
|
12128
|
+
addSafeMethods(obj);
|
|
12129
|
+
|
|
12130
|
+
// Get prototype methods
|
|
12131
|
+
let proto;
|
|
12132
|
+
try {
|
|
12133
|
+
proto = Object.getPrototypeOf(obj);
|
|
12134
|
+
} catch {
|
|
12135
|
+
proto = null;
|
|
12136
|
+
}
|
|
12137
|
+
|
|
12138
|
+
while (proto && proto !== Object.prototype) {
|
|
12139
|
+
addSafeMethods(proto, false);
|
|
12140
|
+
try {
|
|
12141
|
+
proto = Object.getPrototypeOf(proto);
|
|
12142
|
+
} catch {
|
|
12143
|
+
proto = null;
|
|
12144
|
+
}
|
|
12119
12145
|
}
|
|
12120
12146
|
|
|
12121
12147
|
return Array.from(methods).sort();
|
package/dist/index.d.ts
CHANGED
|
@@ -12100,22 +12100,48 @@ function getAvailableMethods(obj) {
|
|
|
12100
12100
|
|
|
12101
12101
|
const methods = new Set();
|
|
12102
12102
|
|
|
12103
|
-
|
|
12104
|
-
|
|
12105
|
-
|
|
12106
|
-
|
|
12103
|
+
const addSafeMethods = (target, includeConstructor = true) => {
|
|
12104
|
+
let names;
|
|
12105
|
+
try {
|
|
12106
|
+
names = Object.getOwnPropertyNames(target);
|
|
12107
|
+
} catch {
|
|
12108
|
+
return;
|
|
12107
12109
|
}
|
|
12108
|
-
});
|
|
12109
12110
|
|
|
12110
|
-
|
|
12111
|
-
|
|
12112
|
-
|
|
12113
|
-
|
|
12114
|
-
|
|
12111
|
+
names.forEach(name => {
|
|
12112
|
+
if (!includeConstructor && name === 'constructor') return;
|
|
12113
|
+
|
|
12114
|
+
let descriptor;
|
|
12115
|
+
try {
|
|
12116
|
+
descriptor = Object.getOwnPropertyDescriptor(target, name);
|
|
12117
|
+
} catch {
|
|
12118
|
+
return;
|
|
12119
|
+
}
|
|
12120
|
+
|
|
12121
|
+
if (descriptor && 'value' in descriptor && typeof descriptor.value === 'function') {
|
|
12115
12122
|
methods.add(name);
|
|
12116
12123
|
}
|
|
12117
12124
|
});
|
|
12118
|
-
|
|
12125
|
+
};
|
|
12126
|
+
|
|
12127
|
+
// Get own properties
|
|
12128
|
+
addSafeMethods(obj);
|
|
12129
|
+
|
|
12130
|
+
// Get prototype methods
|
|
12131
|
+
let proto;
|
|
12132
|
+
try {
|
|
12133
|
+
proto = Object.getPrototypeOf(obj);
|
|
12134
|
+
} catch {
|
|
12135
|
+
proto = null;
|
|
12136
|
+
}
|
|
12137
|
+
|
|
12138
|
+
while (proto && proto !== Object.prototype) {
|
|
12139
|
+
addSafeMethods(proto, false);
|
|
12140
|
+
try {
|
|
12141
|
+
proto = Object.getPrototypeOf(proto);
|
|
12142
|
+
} catch {
|
|
12143
|
+
proto = null;
|
|
12144
|
+
}
|
|
12119
12145
|
}
|
|
12120
12146
|
|
|
12121
12147
|
return Array.from(methods).sort();
|
package/dist/index.js
CHANGED
|
@@ -11391,19 +11391,40 @@ function findSimilar(target, candidates, maxDistance = 3) {
|
|
|
11391
11391
|
function getAvailableMethods(obj) {
|
|
11392
11392
|
if (obj === null || obj === void 0) return [];
|
|
11393
11393
|
const methods = /* @__PURE__ */ new Set();
|
|
11394
|
-
|
|
11395
|
-
|
|
11396
|
-
|
|
11394
|
+
const addSafeMethods = (target, includeConstructor = true) => {
|
|
11395
|
+
let names;
|
|
11396
|
+
try {
|
|
11397
|
+
names = Object.getOwnPropertyNames(target);
|
|
11398
|
+
} catch {
|
|
11399
|
+
return;
|
|
11397
11400
|
}
|
|
11398
|
-
|
|
11399
|
-
|
|
11400
|
-
|
|
11401
|
-
|
|
11402
|
-
|
|
11401
|
+
names.forEach((name) => {
|
|
11402
|
+
if (!includeConstructor && name === "constructor") return;
|
|
11403
|
+
let descriptor;
|
|
11404
|
+
try {
|
|
11405
|
+
descriptor = Object.getOwnPropertyDescriptor(target, name);
|
|
11406
|
+
} catch {
|
|
11407
|
+
return;
|
|
11408
|
+
}
|
|
11409
|
+
if (descriptor && "value" in descriptor && typeof descriptor.value === "function") {
|
|
11403
11410
|
methods.add(name);
|
|
11404
11411
|
}
|
|
11405
11412
|
});
|
|
11406
|
-
|
|
11413
|
+
};
|
|
11414
|
+
addSafeMethods(obj);
|
|
11415
|
+
let proto;
|
|
11416
|
+
try {
|
|
11417
|
+
proto = Object.getPrototypeOf(obj);
|
|
11418
|
+
} catch {
|
|
11419
|
+
proto = null;
|
|
11420
|
+
}
|
|
11421
|
+
while (proto && proto !== Object.prototype) {
|
|
11422
|
+
addSafeMethods(proto, false);
|
|
11423
|
+
try {
|
|
11424
|
+
proto = Object.getPrototypeOf(proto);
|
|
11425
|
+
} catch {
|
|
11426
|
+
proto = null;
|
|
11427
|
+
}
|
|
11407
11428
|
}
|
|
11408
11429
|
return Array.from(methods).sort();
|
|
11409
11430
|
}
|