lodash#lowerCase TypeScript Examples

The following examples show how to use lodash#lowerCase. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: factory.ts    From S2 with MIT License 5 votes vote down vote up
registerIcon = (name: string, svg: string) => {
  SVGMap[lowerCase(name)] = svg;
}
Example #2
Source File: factory.ts    From S2 with MIT License 5 votes vote down vote up
getIcon = (name: string): string => {
  return SVGMap[lowerCase(name)];
}
Example #3
Source File: SubmissionCard.tsx    From fishbowl with MIT License 5 votes vote down vote up
function SubmissionCard(props: {
  onChange: (value: string) => void
  word: string
}) {
  const { t } = useTranslation()
  const currentGame = React.useContext(CurrentGameContext)

  const hasStartingLetterError = (word: string) => {
    return (
      !!currentGame.starting_letter &&
      word.length > 0 &&
      word[0].toLocaleUpperCase() !==
        currentGame.starting_letter.toLocaleUpperCase()
    )
  }

  const hasSimilarSubmissionError = (word: string) => {
    const submittedWords = currentGame.cards.map((card) => lowerCase(card.word))
    return submittedWords.includes(lowerCase(word))
  }

  return (
    <BowlCard>
      <TextField
        size="medium"
        value={props.word}
        error={
          hasStartingLetterError(props.word) ||
          hasSimilarSubmissionError(props.word)
        }
        helperText={
          (currentGame.starting_letter &&
            hasStartingLetterError(props.word) &&
            t(
              "cardSubmission.card.helperLetter",
              `Must start with letter {{ letter }}!`,
              {
                letter: currentGame.starting_letter.toLocaleUpperCase(),
              }
            )) ||
          (hasSimilarSubmissionError(props.word) &&
            t(
              "cardSubmission.card.helperSimilar",
              "Someone made a similar submission - try a new word!"
            ))
        }
        onChange={({ target: { value } }) => {
          props.onChange(value)
        }}
      />
    </BowlCard>
  )
}