Skip to content

Commit 0b1e89d

Browse files
committed
fix: enumerable WellFormed
1 parent 3cc8971 commit 0b1e89d

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

src/utils.ts

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -244,23 +244,31 @@ export function patchForNode16() {
244244
if (String.prototype.toWellFormed === undefined) {
245245
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
246246
// @ts-ignore
247-
String.prototype.toWellFormed = function() {
248-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
249-
// @ts-ignore
250-
return toUSVString(this);
251-
};
247+
Object.defineProperty(String.prototype, 'toWellFormed', {
248+
value: function() {
249+
return toUSVString(this);
250+
},
251+
enumerable: false,
252+
configurable: true,
253+
writable: true,
254+
})
252255
}
253256

254257
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
255258
// @ts-ignore
256259
if (String.prototype.isWellFormed === undefined) {
257260
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
258261
// @ts-ignore
259-
String.prototype.isWellFormed = function() {
260-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
261-
// @ts-ignore
262-
return toUSVString(this) === this;
263-
};
262+
Object.defineProperty(String.prototype, 'isWellFormed', {
263+
value: function() {
264+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
265+
// @ts-ignore
266+
return toUSVString(this) === this;
267+
},
268+
enumerable: false,
269+
configurable: true,
270+
writable: true,
271+
});
264272
}
265273

266274
}

0 commit comments

Comments
 (0)