Skip to content

Commit

Permalink
Remove dependency on lodash/first
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubcolony committed Nov 28, 2023
1 parent 6bcd5e0 commit 0bb8ec2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ApolloClient } from '@apollo/client';
import first from 'lodash/first';
import { DeepPartial } from 'utility-types';
import moveDecimal from 'move-decimal-point';
import {
Expand Down Expand Up @@ -30,7 +29,7 @@ const tryGetRecipient = async (
variables: { address: recipientAddress },
});

return first(data?.getUserByAddress?.items) || null;
return data?.getUserByAddress?.items?.[0] ?? null;
} catch {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ApolloClient } from '@apollo/client';
import first from 'lodash/first';
import {
GetTokenByAddressDocument,
GetTokenByAddressQuery,
Expand Down Expand Up @@ -36,7 +35,7 @@ export const tryGetToken = async (
variables: { address: tokenAddress },
});

return first(data?.getTokenByAddress?.items);
return data?.getTokenByAddress?.items?.[0];
} catch {
return undefined;
}
Expand Down Expand Up @@ -67,7 +66,7 @@ export const tryGetUser = async (
variables: { address: userAddress },
});

return first(data?.getUserByAddress?.items) || null;
return data?.getUserByAddress?.items?.[0] ?? null;
} catch {
return undefined;
}
Expand Down

0 comments on commit 0bb8ec2

Please sign in to comment.