isite 2025.8.1 → 2025.8.3
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 +3 -0
- package/object-options/lib/prototype.js +31 -32
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -44,6 +44,9 @@ module.exports = function init(options) {
|
|
|
44
44
|
args[1] = args[1] || {};
|
|
45
45
|
if (args[1].body && typeof args[1].body == 'object') {
|
|
46
46
|
args[1].body = JSON.stringify(args[1].body);
|
|
47
|
+
} else if (args[1].data && typeof args[1].data == 'object') {
|
|
48
|
+
args[1].body = JSON.stringify(args[1].data);
|
|
49
|
+
delete args[1].data;
|
|
47
50
|
}
|
|
48
51
|
args[1].agent =
|
|
49
52
|
args[1].agent ||
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
exports = module.exports = function init(____0) {
|
|
2
|
-
function
|
|
3
|
-
if (!s) {
|
|
4
|
-
return '';
|
|
5
|
-
}
|
|
2
|
+
site.escapeRegExp = function (s = '') {
|
|
6
3
|
if (typeof s !== 'string') {
|
|
7
4
|
s = s.toString();
|
|
8
5
|
}
|
|
9
6
|
return s.replace(/[\/\\^$*+?.()\[\]{}]/g, '\\$&');
|
|
10
|
-
}
|
|
7
|
+
};
|
|
11
8
|
|
|
12
9
|
if (____0.options.proto.object) {
|
|
13
10
|
if (!Object.prototype.test) {
|
|
@@ -43,11 +40,11 @@ exports = module.exports = function init(____0) {
|
|
|
43
40
|
if (name.indexOf('*') !== -1) {
|
|
44
41
|
name = name.split('*');
|
|
45
42
|
name.forEach((n, i) => {
|
|
46
|
-
name[i] =
|
|
43
|
+
name[i] = site.escapeRegExp(n);
|
|
47
44
|
});
|
|
48
45
|
name = name.join('.*');
|
|
49
46
|
} else {
|
|
50
|
-
name =
|
|
47
|
+
name = site.escapeRegExp(name);
|
|
51
48
|
}
|
|
52
49
|
return this.test('^' + name + '$', 'gium');
|
|
53
50
|
},
|
|
@@ -56,10 +53,14 @@ exports = module.exports = function init(____0) {
|
|
|
56
53
|
if (!Object.prototype.contains) {
|
|
57
54
|
Object.defineProperty(Object.prototype, 'contains', {
|
|
58
55
|
value: function (name) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
56
|
+
return name.split('|').some((n) => n && site.toJson(this).test('^.*' + site.site.escapeRegExpRegExp(n) + '.*$', 'gium'));
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
if (!Object.prototype.contain) {
|
|
61
|
+
Object.defineProperty(Object.prototype, 'contain', {
|
|
62
|
+
value: function (name) {
|
|
63
|
+
return name.split('|').some((n) => n && site.toJson(this).test('^.*' + site.site.escapeRegExpRegExp(n) + '.*$', 'gium'));
|
|
63
64
|
},
|
|
64
65
|
});
|
|
65
66
|
}
|
|
@@ -82,27 +83,29 @@ exports = module.exports = function init(____0) {
|
|
|
82
83
|
}
|
|
83
84
|
if (!Array.prototype.like) {
|
|
84
85
|
Array.prototype.like = function (name) {
|
|
85
|
-
if (typeof name !==
|
|
86
|
+
if (typeof name !== 'string') {
|
|
86
87
|
return !1;
|
|
87
88
|
}
|
|
88
89
|
if (name.indexOf('*') !== -1) {
|
|
89
90
|
name = name.split('*');
|
|
90
91
|
name.forEach((n, i) => {
|
|
91
|
-
name[i] =
|
|
92
|
+
name[i] = site.escapeRegExp(n);
|
|
92
93
|
});
|
|
93
94
|
name = name.join('.*');
|
|
94
95
|
} else {
|
|
95
|
-
name =
|
|
96
|
+
name = site.escapeRegExp(name);
|
|
96
97
|
}
|
|
97
98
|
return this.test('^' + name + '$', 'gium');
|
|
98
99
|
};
|
|
99
100
|
}
|
|
100
101
|
if (!Array.prototype.contains) {
|
|
101
|
-
Array.prototype.contains = function (name) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
102
|
+
Array.prototype.contains = function (name = '') {
|
|
103
|
+
return name.split('|').some((n) => n && site.toJson(this).test('^.*' + site.site.escapeRegExpRegExp(n) + '.*$', 'gium'));
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
if (!Array.prototype.contain) {
|
|
107
|
+
Array.prototype.contain = function (name = '') {
|
|
108
|
+
return name.split('|').some((n) => n && site.toJson(this).test('^.*' + site.site.escapeRegExpRegExp(n) + '.*$', 'gium'));
|
|
106
109
|
};
|
|
107
110
|
}
|
|
108
111
|
}
|
|
@@ -119,14 +122,14 @@ exports = module.exports = function init(____0) {
|
|
|
119
122
|
|
|
120
123
|
if (!String.prototype.like) {
|
|
121
124
|
String.prototype.like = function (name) {
|
|
122
|
-
if (typeof name !==
|
|
125
|
+
if (typeof name !== 'string') {
|
|
123
126
|
return !1;
|
|
124
127
|
}
|
|
125
128
|
let r = !1;
|
|
126
129
|
name.split('|').forEach((n) => {
|
|
127
130
|
n = n.split('*');
|
|
128
131
|
n.forEach((w, i) => {
|
|
129
|
-
n[i] =
|
|
132
|
+
n[i] = site.escapeRegExp(w);
|
|
130
133
|
});
|
|
131
134
|
n = n.join('.*');
|
|
132
135
|
if (this.test('^' + n + '$', 'gium')) {
|
|
@@ -138,17 +141,13 @@ exports = module.exports = function init(____0) {
|
|
|
138
141
|
}
|
|
139
142
|
|
|
140
143
|
if (!String.prototype.contains) {
|
|
141
|
-
String.prototype.contains = function (name) {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
r = !0;
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
return r;
|
|
144
|
+
String.prototype.contains = function (name = '') {
|
|
145
|
+
return name.split('|').some((n) => n && this.test('^.*' + site.site.escapeRegExpRegExp(n) + '.*$', 'gium'));
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
if (!String.prototype.contain) {
|
|
149
|
+
String.prototype.contain = function (name = '') {
|
|
150
|
+
return name.split('|').some((n) => n && this.test('^.*' + site.site.escapeRegExpRegExp(n) + '.*$', 'gium'));
|
|
152
151
|
};
|
|
153
152
|
}
|
|
154
153
|
};
|