Skip to content

Commit af9bd9b

Browse files
committed
indexer-common: replace usage of in for undefined check
A property may be present in an object but have value undefined. Therefore, x in obj is not the same as obj.x === undefined.
1 parent ced81d3 commit af9bd9b

File tree

1 file changed

+2
-2
lines changed
  • packages/indexer-common/src/indexer-management

1 file changed

+2
-2
lines changed

packages/indexer-common/src/indexer-management/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,11 @@ const Caip2ByChainId: { [key: number]: string } = {
165165
/// or chain ids (numbers).
166166
export function resolveChainId(key: number | string): string {
167167
if (typeof key === 'number') {
168-
if (key in Caip2ByChainId) {
168+
if (Caip2ByChainId[key] !== undefined) {
169169
return Caip2ByChainId[key]
170170
}
171171
} else {
172-
if (key in Caip2ByChainAlias) {
172+
if (Caip2ByChainAlias[key] !== undefined) {
173173
return Caip2ByChainAlias[key]
174174
}
175175
}

0 commit comments

Comments
 (0)