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

Ida/implement start page #324

Merged
merged 8 commits into from
Dec 3, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[COMMON] Add script to capitalize first letter of each word
  • Loading branch information
idali0226 committed Dec 3, 2018
commit 790c0f7f45e231999fc441acbdbac4ef0f142d81
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = function capitalizeFirstLetterOfEachWord(string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

it's great you add utilities!

Copy link
Contributor

Choose a reason for hiding this comment

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

even if you don't need it for username when you use name instead, we can still keep this utility

if (!string) {
return string
}
return string
.split(' ')
.map(a => a.charAt(0).toUpperCase() + a.slice(1))
.join(' ')
}
1 change: 1 addition & 0 deletions packages/common/src/stringFormatters/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
exports.camelCaseToUpperSnakeCase = require('./camelCaseToUpperSnakeCase')
exports.capitalizeFirstLetter = require('./capitalizeFirstLetter')
exports.capitalizeFirstLetterOfEachWord = require('./capitalizeFirstLetterOfEachWord')
6 changes: 5 additions & 1 deletion packages/common/src/stringFormatters/index.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
const exportedFunctions = require('./index')

const expectedFunctions = ['capitalizeFirstLetter', 'camelCaseToUpperSnakeCase']
const expectedFunctions = [
'capitalizeFirstLetter',
'capitalizeFirstLetterOfEachWord',
'camelCaseToUpperSnakeCase',
]

describe('stringFormatters', () => {
it('exports expected functions', () => {
Expand Down