(polyfill) simple polyfill for Object.hasOwn

This commit is contained in:
Valentyne Stigloher 2024-03-12 13:57:38 +01:00
parent 52b7d2114e
commit d148b53f3b
2 changed files with 10 additions and 0 deletions

View File

@ -166,6 +166,7 @@ const nuxtConfig: NuxtConfig = {
'~/assets/style.scss',
],
plugins: [
{ src: '~/plugins/polyfill.ts', mode: 'client' },
{ src: '~/plugins/axios.js' },
{ src: '~/plugins/globals.ts' },
{ src: '~/plugins/auth.ts' },

9
plugins/polyfill.ts Normal file
View File

@ -0,0 +1,9 @@
export default (): void => {
if (!Object.prototype.hasOwnProperty.call(Object, 'hasOwn')) {
Object.defineProperty(Object, 'hasOwn', {
value: (object: object, property: PropertyKey) => {
return Object.prototype.hasOwnProperty.call(object, property);
},
});
}
};