This repository was archived by the owner on Feb 20, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change
1
+ export default capitalizeFirstLetter
2
+
3
+ /**
4
+ * Original source: https://stackoverflow.com/questions/1026069/
5
+ * This function would convert the first letter of any string passed to it into uppercase
6
+ * it is a copy
7
+ * @param {string }string - The string to capitalize the first letter of a string
8
+ * @return {string } - The capitalized string
9
+ **/
10
+ function capitalizeFirstLetter ( string ) {
11
+ return string . charAt ( 0 ) . toUpperCase ( ) + string . slice ( 1 )
12
+ }
Original file line number Diff line number Diff line change 1
1
import isEven from './is-even'
2
+ import capitalizeFirstLetter from './convert-first-letter-to-capital'
2
3
import revstring from './revstring'
3
4
import initArray from './init-array'
4
5
import reduce from './reduce-to-tally'
@@ -52,6 +53,7 @@ import median from './array-median'
52
53
53
54
export {
54
55
isOdd ,
56
+ capitalizeFirstLetter ,
55
57
isEven ,
56
58
revstring ,
57
59
initArray ,
Original file line number Diff line number Diff line change
1
+ import test from 'ava'
2
+ import { capitalizeFirstLetter } from '../src'
3
+
4
+ test ( 'capitalize first letter' , t => {
5
+ const original = 'oyinkan'
6
+ const expected = 'Oyinkan'
7
+ const actual = capitalizeFirstLetter ( original )
8
+ t . deepEqual ( actual , expected )
9
+ } )
You can’t perform that action at this time.
0 commit comments