Skip to content

Commit 2ed1c07

Browse files
committed
chore: object.hasOwn
1 parent 5fd9bff commit 2ed1c07

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/base/deck/storage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ onPage('Decks', function deckStorage() {
6969
const key = getKey(id);
7070
const deck = JSON.parse(localStorage.getItem(key));
7171
if (!deck) return;
72-
if (!Object.prototype.hasOwnProperty.call(deck, 'cards')) {
72+
if (!Object.hasOwn(deck, 'cards')) {
7373
localStorage.setItem(key, JSON.stringify({
7474
cards: deck,
7575
artifacts: [],

src/base/leaderboard/goto.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import changePage from '../vanilla/pageSelect.js';
77

88
function set(type, value, replace = true) {
99
if (history.state &&
10-
Object.prototype.hasOwnProperty.call(history.state, type) &&
10+
Object.hasOwn(history.state, type) &&
1111
history.state[type] === value) return;
1212
const func = replace && !userLast() ? history.replaceState : history.pushState;
1313
const o = {};

src/utils/global.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export function global(...key) {
44
const {
55
throws = true,
66
} = typeof key[key.length - 1] === 'object' ? key.pop() : {};
7-
const found = key.find((e) => Object.prototype.hasOwnProperty.call(window, e));
7+
const found = key.find((e) => Object.hasOwn(window, e));
88
if (found === undefined) {
99
const msg = `[${key.join(',')}] does not exist`;
1010
if (throws) throw new Error(msg);
@@ -16,7 +16,7 @@ export function global(...key) {
1616
export function globalSet(key, value, {
1717
throws = true,
1818
} = {}) {
19-
if (!Object.prototype.hasOwnProperty.call(window, key)) {
19+
if (!Object.hasOwn(window, key)) {
2020
const msg = `[${key}] does not exist`;
2121
if (throws) throw new Error(msg);
2222
return debug(msg);

0 commit comments

Comments
 (0)