Skip to content

Commit

Permalink
feat: Add "toUpper" function to convert strings into UPPER CASE
Browse files Browse the repository at this point in the history
  • Loading branch information
andreidmt committed Nov 5, 2020
1 parent 95ae78c commit eb9e2f9
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export { split } from "./split/split"
export { startsWith } from "./starts-with/starts-with"
export { endsWith } from "./ends-with/ends-with"
export { toLower } from "./to-lower/to-lower"
export { toUpper } from "./to-upper/to-upper"
export { trim } from "./trim/trim"
export { contains } from "./contains/contains"
export { join } from "./join/join"
Expand Down
4 changes: 1 addition & 3 deletions src/to-lower/to-lower.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,4 @@
* toLower("Lorem Ipsum")
* // "lorem ipsum"
*/
const toLower = source => "".toLowerCase.call(source)

export { toLower }
export const toLower = source => "".toLowerCase.call(source)
8 changes: 2 additions & 6 deletions src/to-lower/to-lower.test.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import test from "tape"
import { toLower } from ".."
import { toLower } from "./to-lower"

test("toLower", t => {
const source = "Lorem Opsum"

t.equals(
toLower(source),
"lorem opsum",
"Convert uppercase chars into lowercase"
)
t.equals(toLower(source), "lorem opsum", "Convert chars into lowercase")

t.end()
})
15 changes: 15 additions & 0 deletions src/to-upper/to-upper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Convert string to upper case
*
* @tag String
* @signature (source: string): string
*
* @param {string} source Source string
*
* @return {string}
*
* @example
* toUpper("Lorem Ipsum")
* // "LOREM IPSUM"
*/
export const toUpper = source => "".toUpperCase.call(source)
10 changes: 10 additions & 0 deletions src/to-upper/to-upper.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import test from "tape"
import { toUpper } from "./to-upper"

test("toUpper", t => {
const source = "Lorem Opsum"

t.equals(toUpper(source), "LOREM OPSUM", "Convert chars into uppercase")

t.end()
})

0 comments on commit eb9e2f9

Please sign in to comment.