Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

Commit

Permalink
refactor: convert logical operator to optional chainining
Browse files Browse the repository at this point in the history
The [optional chaining](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining) operator can be used to perform null checks before accessing a property, or calling a function.
  • Loading branch information
deepsource-autofix[bot] authored Aug 28, 2023
1 parent 022054f commit 18e249e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/karbon/src/runtime/composables/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,5 +155,5 @@ async function convertToId(scope: PayloadScope, resourceID: any): Promise<string
async function findGroupTags(groupKey: string, id: string) {
const group = await loadStoripressPayloadWithURL('_custom-field-group')
const tags = group[groupKey]
return tags && tags.includes(id)
return tags?.includes(id)
}
2 changes: 1 addition & 1 deletion packages/karbon/src/track.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ async function getAnonymousId(): Promise<string> {
}

const thunk = findCacheDirectory({ name: 'storipress', thunk: true })
const cachePath = thunk && thunk('cli-cache')
const cachePath = thunk?.('cli-cache')
const storage = createStorage({
driver: fsDriver({ base: cachePath }),
})
Expand Down

0 comments on commit 18e249e

Please sign in to comment.