@optique/core 1.0.0-dev.1846 → 1.0.0-dev.1848
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/annotations.cjs +6 -4
- package/dist/annotations.js +6 -4
- package/package.json +1 -1
package/dist/annotations.cjs
CHANGED
|
@@ -225,11 +225,13 @@ function createProtectedDateView(target) {
|
|
|
225
225
|
}
|
|
226
226
|
function createProtectedRegExpView(target) {
|
|
227
227
|
const methodCache = /* @__PURE__ */ new Map();
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
|
|
228
|
+
const cloned = new RegExp(target);
|
|
229
|
+
cloned.lastIndex = target.lastIndex;
|
|
230
|
+
const view = new Proxy(cloned, {
|
|
231
|
+
get(clonedTarget, key) {
|
|
232
|
+
const value = Reflect.get(clonedTarget, key, clonedTarget);
|
|
231
233
|
if (key === "compile") return cacheProtectedMethod(methodCache, key, () => (..._args) => throwReadonlyAnnotationMutation());
|
|
232
|
-
return typeof value === "function" ? value.bind(
|
|
234
|
+
return typeof value === "function" ? value.bind(clonedTarget) : value;
|
|
233
235
|
},
|
|
234
236
|
set() {
|
|
235
237
|
throwReadonlyAnnotationMutation();
|
package/dist/annotations.js
CHANGED
|
@@ -224,11 +224,13 @@ function createProtectedDateView(target) {
|
|
|
224
224
|
}
|
|
225
225
|
function createProtectedRegExpView(target) {
|
|
226
226
|
const methodCache = /* @__PURE__ */ new Map();
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
|
|
227
|
+
const cloned = new RegExp(target);
|
|
228
|
+
cloned.lastIndex = target.lastIndex;
|
|
229
|
+
const view = new Proxy(cloned, {
|
|
230
|
+
get(clonedTarget, key) {
|
|
231
|
+
const value = Reflect.get(clonedTarget, key, clonedTarget);
|
|
230
232
|
if (key === "compile") return cacheProtectedMethod(methodCache, key, () => (..._args) => throwReadonlyAnnotationMutation());
|
|
231
|
-
return typeof value === "function" ? value.bind(
|
|
233
|
+
return typeof value === "function" ? value.bind(clonedTarget) : value;
|
|
232
234
|
},
|
|
233
235
|
set() {
|
|
234
236
|
throwReadonlyAnnotationMutation();
|