forked from Technigo/unit-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kristiina Kolu
authored and
Kristiina Kolu
committed
Feb 21, 2022
1 parent
88093f6
commit 8ce560a
Showing
10 changed files
with
8,382 additions
and
167 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export const multiply = (a, b) => { | ||
a * b | ||
return a * b | ||
} |
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 |
---|---|---|
@@ -1,3 +1,11 @@ | ||
export const firstLast = (items) => { | ||
return `First: ${items[0]}, Last: ${items[1]}` | ||
if (!items.length){ | ||
return `No items!` | ||
} | ||
else if (items.length === 1){ | ||
return `Only item: ${items[0]}` | ||
} | ||
else{ | ||
return `First: ${items[0]}, Last: ${items[items.length-1]}` | ||
} | ||
} |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export const findIndex = (array, value) => { | ||
return | ||
return array.indexOf(value) | ||
} |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export const angleCalculator = (turns) => { | ||
return | ||
return (turns * 360) | ||
} |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export const filterNumbers = (array, largerThan) => { | ||
return array | ||
return array.filter(item => item <= largerThan) | ||
} |
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 |
---|---|---|
@@ -1,9 +1,16 @@ | ||
export const isEmpty = (stringArrayOrObject) => { | ||
const type = typeof stringArrayOrObject | ||
|
||
if (type === 'string') { | ||
return stringArrayOrObject === '' | ||
if (type === 'string' && stringArrayOrObject.length){ | ||
return false | ||
} | ||
else if (Object.prototype.toString.call(stringArrayOrObject) === '[object Array]' && stringArrayOrObject.length){ | ||
return false | ||
} | ||
else if (Object.prototype.toString.call(stringArrayOrObject) === '[object Object]' && Object.keys(stringArrayOrObject).length){ | ||
return false | ||
} | ||
else{ | ||
return true | ||
} | ||
|
||
return false | ||
} |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export const hackerSpeak = (words) => { | ||
return words | ||
return words.replaceAll("a", "4").replaceAll("e", "3", true).replaceAll("i", "1", true) | ||
.replaceAll("o", "0", true).replaceAll("s", "5", true).replaceAll("A", "4").replaceAll("E", "3", true).replaceAll("I", "1", true) | ||
.replaceAll("O", "0", true).replaceAll("S", "5", true) | ||
} |
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 |
---|---|---|
@@ -1,3 +1,10 @@ | ||
export const hashtags = (text) => { | ||
return text | ||
let splitArray = text.split(" ") | ||
let hastagsArray = [] | ||
for(let i = 0; i < splitArray.length; i++){ | ||
if (splitArray[i].charAt(0) === '#'){ | ||
hastagsArray.push(splitArray[i]) | ||
} | ||
} | ||
return(hastagsArray) | ||
} |