Skip to content

Commit

Permalink
refactor: use for in instead of Object.entries
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurfiorette committed Sep 26, 2021
1 parent f8adcc4 commit 5b9847d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/util/cache-predicate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ export function checkPredicateObject(
}

if (containsHeader) {
for (const [headerName, value] of Object.entries(containsHeader)) {
for (const headerName in containsHeader) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const value = containsHeader[headerName]!;
const header = response.headers[headerName];

// At any case, if the header is not found, the predicate fails.
Expand Down
5 changes: 4 additions & 1 deletion src/util/update-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ export async function updateCache(
data: any,
entries: Record<string, CacheUpdater>
): Promise<void> {
for (const [cacheKey, value] of Object.entries(entries)) {
for (const cacheKey in entries) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const value = entries[cacheKey]!;

if (value == 'delete') {
await axios.storage.remove(cacheKey);
continue;
Expand Down

0 comments on commit 5b9847d

Please sign in to comment.