-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: remove account form fields label camel case
- Loading branch information
1 parent
224c2b3
commit 7dfbdc4
Showing
8 changed files
with
96 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { RegisterFields } from '@/pages/registered/config' | ||
|
||
const manipulateString = (input: string): string => { | ||
if (!input) return '' | ||
const words = input.split(' ') | ||
|
||
if (words.length === 0) { | ||
return input | ||
} | ||
|
||
const firstWord = words[0] | ||
const manipulatedWords = words | ||
.slice(1) | ||
.map((word) => word.charAt(0).toLowerCase() + word.slice(1)) | ||
|
||
return [firstWord, ...manipulatedWords].join(' ') | ||
} | ||
|
||
const convertLabel = (infos: RegisterFields[]) => | ||
infos.map((info: RegisterFields) => { | ||
const { label } = info | ||
if (label) { | ||
info.label = manipulateString(label) | ||
} | ||
|
||
return info | ||
}) || [] | ||
|
||
export { convertLabel, manipulateString } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters