isite 2025.8.2 → 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/object-options/lib/prototype.js +17 -50
- package/package.json +1 -1
|
@@ -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,20 +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
|
-
return !1;
|
|
61
|
-
}
|
|
62
|
-
return this.test('^.*' + escape(name) + '.*$', 'gium');
|
|
56
|
+
return name.split('|').some((n) => n && site.toJson(this).test('^.*' + site.site.escapeRegExpRegExp(n) + '.*$', 'gium'));
|
|
63
57
|
},
|
|
64
58
|
});
|
|
65
59
|
}
|
|
66
60
|
if (!Object.prototype.contain) {
|
|
67
61
|
Object.defineProperty(Object.prototype, 'contain', {
|
|
68
62
|
value: function (name) {
|
|
69
|
-
|
|
70
|
-
return !1;
|
|
71
|
-
}
|
|
72
|
-
return this.test('^.*' + escape(name) + '.*$', 'gium');
|
|
63
|
+
return name.split('|').some((n) => n && site.toJson(this).test('^.*' + site.site.escapeRegExpRegExp(n) + '.*$', 'gium'));
|
|
73
64
|
},
|
|
74
65
|
});
|
|
75
66
|
}
|
|
@@ -98,29 +89,23 @@ exports = module.exports = function init(____0) {
|
|
|
98
89
|
if (name.indexOf('*') !== -1) {
|
|
99
90
|
name = name.split('*');
|
|
100
91
|
name.forEach((n, i) => {
|
|
101
|
-
name[i] =
|
|
92
|
+
name[i] = site.escapeRegExp(n);
|
|
102
93
|
});
|
|
103
94
|
name = name.join('.*');
|
|
104
95
|
} else {
|
|
105
|
-
name =
|
|
96
|
+
name = site.escapeRegExp(name);
|
|
106
97
|
}
|
|
107
98
|
return this.test('^' + name + '$', 'gium');
|
|
108
99
|
};
|
|
109
100
|
}
|
|
110
101
|
if (!Array.prototype.contains) {
|
|
111
|
-
Array.prototype.contains = function (name) {
|
|
112
|
-
|
|
113
|
-
return !1;
|
|
114
|
-
}
|
|
115
|
-
return this.test('^.*' + escape(name) + '.*$', 'gium');
|
|
102
|
+
Array.prototype.contains = function (name = '') {
|
|
103
|
+
return name.split('|').some((n) => n && site.toJson(this).test('^.*' + site.site.escapeRegExpRegExp(n) + '.*$', 'gium'));
|
|
116
104
|
};
|
|
117
105
|
}
|
|
118
106
|
if (!Array.prototype.contain) {
|
|
119
|
-
Array.prototype.contain = function (name) {
|
|
120
|
-
|
|
121
|
-
return !1;
|
|
122
|
-
}
|
|
123
|
-
return this.test('^.*' + escape(name) + '.*$', 'gium');
|
|
107
|
+
Array.prototype.contain = function (name = '') {
|
|
108
|
+
return name.split('|').some((n) => n && site.toJson(this).test('^.*' + site.site.escapeRegExpRegExp(n) + '.*$', 'gium'));
|
|
124
109
|
};
|
|
125
110
|
}
|
|
126
111
|
}
|
|
@@ -144,7 +129,7 @@ exports = module.exports = function init(____0) {
|
|
|
144
129
|
name.split('|').forEach((n) => {
|
|
145
130
|
n = n.split('*');
|
|
146
131
|
n.forEach((w, i) => {
|
|
147
|
-
n[i] =
|
|
132
|
+
n[i] = site.escapeRegExp(w);
|
|
148
133
|
});
|
|
149
134
|
n = n.join('.*');
|
|
150
135
|
if (this.test('^' + n + '$', 'gium')) {
|
|
@@ -156,31 +141,13 @@ exports = module.exports = function init(____0) {
|
|
|
156
141
|
}
|
|
157
142
|
|
|
158
143
|
if (!String.prototype.contains) {
|
|
159
|
-
String.prototype.contains = function (name) {
|
|
160
|
-
|
|
161
|
-
if (typeof name !== 'string') {
|
|
162
|
-
return r;
|
|
163
|
-
}
|
|
164
|
-
name.split('|').forEach((n) => {
|
|
165
|
-
if (n && this.test('^.*' + escape(n) + '.*$', 'gium')) {
|
|
166
|
-
r = !0;
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
return r;
|
|
144
|
+
String.prototype.contains = function (name = '') {
|
|
145
|
+
return name.split('|').some((n) => n && this.test('^.*' + site.site.escapeRegExpRegExp(n) + '.*$', 'gium'));
|
|
170
146
|
};
|
|
171
147
|
}
|
|
172
148
|
if (!String.prototype.contain) {
|
|
173
|
-
String.prototype.contain = function (name) {
|
|
174
|
-
|
|
175
|
-
if (typeof name !== 'string') {
|
|
176
|
-
return r;
|
|
177
|
-
}
|
|
178
|
-
name.split('|').forEach((n) => {
|
|
179
|
-
if (n && this.test('^.*' + escape(n) + '.*$', 'gium')) {
|
|
180
|
-
r = !0;
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
return r;
|
|
149
|
+
String.prototype.contain = function (name = '') {
|
|
150
|
+
return name.split('|').some((n) => n && this.test('^.*' + site.site.escapeRegExpRegExp(n) + '.*$', 'gium'));
|
|
184
151
|
};
|
|
185
152
|
}
|
|
186
153
|
};
|