Skip to content

Commit

Permalink
Switch from Object.hasOwn to Object.prototype.hasOwnProperty
Browse files Browse the repository at this point in the history
  • Loading branch information
edemaine committed Aug 15, 2024
1 parent 09a81ce commit 505e6fa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/esbuild/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ export function unwrapLoader(
// `load` and `transform` may return a sourcemap without toString and toUrl,
// but esbuild needs them, we fix the two methods
export function fixSourceMap(map: EncodedSourceMap): SourceMap {
if (!Object.hasOwn(map, 'toString')) {
if (!Object.prototype.hasOwnProperty.call(map, 'toString')) {
Object.defineProperty(map, 'toString', {
enumerable: false,
value: function toString() {
return JSON.stringify(this)
},
})
}
if (!Object.hasOwn(map, 'toUrl')) {
if (!Object.prototype.hasOwnProperty.call(map, 'toUrl')) {
Object.defineProperty(map, 'toUrl', {
enumerable: false,
value: function toUrl() {
Expand Down

0 comments on commit 505e6fa

Please sign in to comment.