Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add lowerCase and upperCase #47

Merged
merged 9 commits into from
Oct 9, 2023
Merged

Conversation

jly36963
Copy link
Contributor

@jly36963 jly36963 commented Oct 6, 2023

No description provided.

README.md Outdated
### lowerCase

This function converts a string to `lower case` at both runtime and type levels.
_NOTE: this function will split by words and join them with `" "`._
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggestion for a better warning?
I want it to be crystal clear that toUpperCase and upperCase are significantly different
(Same with the lower counterparts)

src/casing.ts Outdated
/**
* Transforms a string to lowercase, with words delimited by a space.
*/
type LowerCase<T extends string> = Join<LowerCaseAll<Words<T>>, ' '>
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
type LowerCase<T extends string> = Join<LowerCaseAll<Words<T>>, ' '>
type LowerCase<T extends string> = Lowercase<DelimiterCase<T, ' '>>
function lowerCase<T extends string>(str: T): LowerCase<T> {
return toLowerCase(delimiterCase(str, ' '))
}

Copy link
Owner

Choose a reason for hiding this comment

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

No need for LowerCaseAll

README.md Outdated
```ts
import { lowerCase } from 'string-ts'

const str = 'HELLO WORLD'
Copy link
Owner

Choose a reason for hiding this comment

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

Maybe make it clearer

Suggested change
const str = 'HELLO WORLD'
const str = 'HELLO [WORLD]...'

@jly36963 jly36963 marked this pull request as ready for review October 6, 2023 16:17
Copy link
Owner

@gustavoguichard gustavoguichard left a comment

Choose a reason for hiding this comment

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

LGTM

@gustavoguichard gustavoguichard merged commit 091f67b into main Oct 9, 2023
1 check passed
@gustavoguichard gustavoguichard deleted the add-lower-and-upper branch October 9, 2023 09:02
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.

2 participants