Skip to content

Commit

Permalink
refactor: lift capitalizeFirstChar to util
Browse files Browse the repository at this point in the history
  • Loading branch information
rhyslbw committed Feb 1, 2021
1 parent b4805c6 commit 8ecb326
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/api-cardano-db-hasura/src/CardanoCli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { exec } from 'child_process'
import { Genesis, ShelleyProtocolParams } from './graphql_types'
import { Config } from './Config'
import { LedgerState } from './CardanoNodeClient'
import { knownEras } from '@cardano-graphql/util'
import { knownEras, capitalizeFirstChar } from '@cardano-graphql/util'

export interface CardanoCliTip {
blockNo: number,
Expand All @@ -14,7 +14,7 @@ export type ProtocolParams = ShelleyProtocolParams
const isEraMismatch = (errorMessage: string, era: string): boolean => {
return errorMessage.includes('EraMismatch') ||
errorMessage.includes(
`The attempted local state query does not support the ${era.charAt(0).toUpperCase().concat(era.slice(1))} protocol`
`The attempted local state query does not support the ${capitalizeFirstChar(era)} protocol`
)
}

Expand Down
1 change: 1 addition & 0 deletions packages/util/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { loadQueryNode } from './queryNodeLoading'
import * as scalars from './scalars'
export * from './data_fetching'
export * from './knownEras'
export * from './stringModifiers'

export default {
onFailedAttemptFor,
Expand Down
2 changes: 2 additions & 0 deletions packages/util/src/stringModifiers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

export const capitalizeFirstChar = (word: string): string => word.charAt(0).toUpperCase().concat(word.slice(1))

0 comments on commit 8ecb326

Please sign in to comment.