Skip to content

Conversation

arjunlalb
Copy link
Contributor

@arjunlalb arjunlalb commented Mar 18, 2021

Description

Remove redundant string formatter methods. Usages to be replaced with startCase in lodash.

Testing

N/A

Checklist:

  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Any dependent changes have been merged and published in downstream modules

@arjunlalb arjunlalb requested a review from a team as a code owner March 18, 2021 15:34
@codecov
Copy link

codecov bot commented Mar 18, 2021

Codecov Report

Merging #703 (241da49) into main (4b9b49b) will decrease coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #703      +/-   ##
==========================================
- Coverage   85.16%   85.15%   -0.01%     
==========================================
  Files         782      782              
  Lines       16042    16036       -6     
  Branches     2048     2046       -2     
==========================================
- Hits        13662    13656       -6     
  Misses       2347     2347              
  Partials       33       33              
Impacted Files Coverage Δ
...rc/utilities/formatters/string/string-formatter.ts 100.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4b9b49b...241da49. Read the comment docs.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

.join(' ');
export const titleCaseFromKebabCase = (kebabCaseString: string): string => titleCaseFromString(kebabCaseString, '-');

export const titleCaseFromWhiteSpacedString = (whiteSpacedString: string): string =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this method similar to Lodash's 'startCase' ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need this new method? 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

startCase works for the other cases for which we've defined util methods as well (kebab/snake case to title case). Going by that, my understanding was that if its light enough, we'll define our own?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going by that, my understanding was that if its light enough, we'll define our own?

I think that goes more for components (as the styling on these evolves) or for util function that we'd need to bring in a new dependency for (such as the whole iso duration thing). If we had no lodash dependency, we shouldn't bring it in for this - but since we do have it and it's already in widespread use, we should be ok to use it where it does exactly what we want.

They might have been written without knowing about start case - or maybe they behave a little differently? If the behavior is identical, then we need not implement it ourselves - although we likely leave the existing ones here for backwards compatibility (could deprecate them, though)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would vote for deprecating them if they are exactly the same.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd also prefer deprecating them then. startCase works for whitespaced, kebab case and snake cased strings.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deprecated.

@arjunlalb arjunlalb changed the title feat: utility method to title case all words in a whitespace separated string fix: remove redundant string formatter methods Mar 19, 2021
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@arjunlalb arjunlalb merged commit 69e1314 into main Mar 22, 2021
@arjunlalb arjunlalb deleted the title-case-whitespaced branch March 22, 2021 04:15
@github-actions
Copy link

Unit Test Results

    4 files  ±0  244 suites  ±0   15m 13s ⏱️ +15s
875 tests  - 2  875 ✔️  - 2  0 💤 ±0  0 ❌ ±0 
879 runs   - 2  879 ✔️  - 2  0 💤 ±0  0 ❌ ±0 

Results for commit 69e1314. ± Comparison against base commit 4b9b49b.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants