Skip to content

Capitalize only first letter of each word. Leave the rest of letters …#9

Merged
grncdr merged 2 commits intogrncdr:masterfrom
sergejkaravajnij:develop
Nov 2, 2019
Merged

Capitalize only first letter of each word. Leave the rest of letters …#9
grncdr merged 2 commits intogrncdr:masterfrom
sergejkaravajnij:develop

Conversation

@sergejkaravajnij
Copy link
Copy Markdown
Contributor

Hello.
I’ve added a new method to capitalize only first letter of each word like CSS rule text-transform: capitalize do.
I found this was a reason of my automated tests failed sometimes.

@markjaquith
Copy link
Copy Markdown

Isn't this what capitalize.words() does?

@sergejkaravajnij
Copy link
Copy Markdown
Contributor Author

sergejkaravajnij commented Oct 13, 2019

Isn't this what capitalize.words() does?

There is a small difference exists which I cought in my automated tests.

Let assume we have such input string: canDoItRight

  • With CSS rule applied we've got: CanDoItRight

  • With capitalize.words() we'll have: Candoitright

That's the difference

If the preserve argument is truthy, letters that are not capitalized will not be modified.
@grncdr
Copy link
Copy Markdown
Owner

grncdr commented Nov 2, 2019

thanks @sergejkaravajnij ! I think this is a useful addition, but I’ve slightly refactored the proposed API.

@grncdr grncdr merged commit 666e76a into grncdr:master Nov 2, 2019
@sergejkaravajnij sergejkaravajnij deleted the develop branch November 30, 2019 10:35
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