File tree Expand file tree Collapse file tree 4 files changed +9
-17
lines changed Expand file tree Collapse file tree 4 files changed +9
-17
lines changed Original file line number Diff line number Diff line change @@ -12,12 +12,9 @@ const lower = (str) => {
1212 throw new TypeError ( 'Invalid Input Type' )
1313 }
1414
15- return str
16- . replace ( / [ A - Z ] / g, ( _ , indexOfUpperChar ) => {
17- const asciiCode = str . charCodeAt ( indexOfUpperChar )
18-
19- return String . fromCharCode ( asciiCode + 32 )
20- } )
15+ return str . replace (
16+ / [ A - Z ] / g, ( char ) => String . fromCharCode ( char . charCodeAt ( ) + 32 )
17+ )
2118}
2219
23- export { lower }
20+ export default lower
Original file line number Diff line number Diff line change @@ -12,13 +12,8 @@ const upper = (str) => {
1212 }
1313
1414 return str . replace (
15- / [ a - z ] / g,
16- ( _ , indexOfLowerChar ) => {
17- const asciiCode = str . charCodeAt ( indexOfLowerChar )
18-
19- return String . fromCharCode ( asciiCode - 32 )
20- }
15+ / [ a - z ] / g, ( char ) => String . fromCharCode ( char . charCodeAt ( ) - 32 )
2116 )
2217}
2318
24- export { upper }
19+ export default upper
Original file line number Diff line number Diff line change 1- import { lower } from '../Lower'
1+ import lower from '../Lower'
22
33describe ( 'Testing the Lower function' , ( ) => {
44 it ( 'Test 1: Check by invalid type' , ( ) => {
Original file line number Diff line number Diff line change 1- import { upper } from '../Upper'
1+ import upper from '../Upper'
22
3- describe ( 'Upper' , ( ) => {
3+ describe ( 'Testing the Upper function ' , ( ) => {
44 it ( 'return uppercase strings' , ( ) => {
55 expect ( upper ( 'hello' ) ) . toBe ( 'HELLO' )
66 expect ( upper ( 'WORLD' ) ) . toBe ( 'WORLD' )
You can’t perform that action at this time.
0 commit comments