Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
1. Ensure you know how to run the unit test:
* `npm test main.js`
1. Use a whiteboard to work out a solution to building the Pig Latin program
1. Use a whiteboard to work out a solution to building the Pig Latin program
1. Translate the broad ideas to pseudo code
1. Convert the pseudo code to real JavaScript Code
1. Type into your text editor the JavaScript code you've come up with one step at a time
Expand Down
15 changes: 13 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,21 @@ const rl = readline.createInterface({


const pigLatin = (word) => {

// Your code here

word = word.toLowerCase().trim()
let vowels = ["a", "e", "i", "o", "u"];
let newWord = ''

if (vowels.includes(word[0])) {
return word + "yay";
} else {
let arr = word.match(/[aeiou]/g) || 0;
let vIndex = word.indexOf(arr[0]);
newWord = word.slice(vIndex) + word.slice(0, vIndex) + 'ay';
return newWord
}
}
pigLatin("")

// the first function called in the program to get an input from the user
// to run the function use the command: node main.js
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
},
"homepage": "https://github.com/AustinCodingAcademy/JS211_PigLatinProject#readme",
"dependencies": {
"eslint": "^3.19.0",
"eslint": "^8.26.0",
"functional-javascript-workshop": "^1.0.6",
"htmllint-cli": "github:kevincolten/htmllint-cli",
"http-server": "^0.11.1",
"javascripting": "^2.6.1",
"jsdom": "^11.6.2",
"http-server": "^14.1.1",
"javascripting": "^2.4.0",
"jsdom": "^20.0.1",
"mocha": "^5.0.0",
"postcss-html": "^0.34.0",
"stylelint": "^7.13.0"
"stylelint": "^14.14.0"
}
}