Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

should be the only commit I need :) #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
Binary file modified .DS_Store
Binary file not shown.
26 changes: 23 additions & 3 deletions async-all-word-count.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const countWords = function(paragraph) {
wordsFound.forEach(word => {
outputString += `${word}: ${wordBank[word]}\n`;
})

// console.log(outputString);
return outputString;
}

Expand All @@ -66,5 +66,25 @@ const countWords = function(paragraph) {
// EXAMPLE USAGE
// countAllWords('./input.txt', './output.txt') --> should output a .txt file in same directory
var countAllWords = function(inputFile, outputFile) {
/* WRITE CODE HERE */
}
fs.readFile(inputFile, function(err, data) {
if (err) {
console.log(err);
return;
}
fs.writeFile(outputFile, countWords(data.toString()), function(err) {
if (err) {
console.log(err);
return;
} else {
console.log('saved');
}
})
})
}
countAllWords('./input.txt','./output.txt');






2 changes: 1 addition & 1 deletion input.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Tenderloin strip steak chuck, bacon swine ham hock prosciutto beef ribs landjaeger capicola pork loin. Porchetta jerky cupim, kevin beef ribs bacon ham hock biltong prosciutto t-bone bresaola turducken strip steak. Pork belly turducken flank, doner meatloaf capicola pig sausage t-bone tri-tip corned beef spare ribs frankfurter picanha. Kielbasa spare ribs picanha, bresaola pancetta fatback strip steak shank chuck cupim turducken. Bacon brisket pork loin ball tip jowl. Sausage turducken t-bone meatloaf beef ribs landjaeger shoulder venison shank ham. Prosciutto ball tip kielbasa capicola filet mignon cupim, pastrami meatball tenderloin ribeye doner pancetta tongue spare ribs. Andouille short loin tongue sausage frankfurter pork chop pork loin pancetta. Porchetta pastrami prosciutto, tenderloin pork belly ball tip strip steak flank pork loin ground round rump t-bone filet mignon beef ribs. Fatback tongue ham hock shankle salami shoulder pork loin.
Tenderloin strip steak chuck bacon swine ham hock prosciutto beef ribs landjaeger capicola pork loin Porchetta jerky cupim kevin beef ribs bacon ham hock biltong prosciutto t-bone bresaola turducken strip steak Pork belly turducken flank doner meatloaf capicola pig sausage t-bone tri-tip corned beef spare ribs frankfurter picanha Kielbasa spare ribs picanha bresaola pancetta fatback strip steak shank chuck cupim turducken Bacon brisket pork loin ball tip jowl Sausage turducken t-bone meatloaf beef ribs landjaeger shoulder venison shank ham Prosciutto ball tip kielbasa capicola filet mignon cupim pastrami meatball tenderloin ribeye doner pancetta tongue spare ribs Andouille short loin tongue sausage frankfurter pork chop pork loin pancetta Porchetta pastrami prosciutto tenderloin pork belly ball tip strip steak flank pork loin ground round rump t-bone filet mignon beef ribs Fatback tongue ham hock shankle salami shoulder pork loin
58 changes: 58 additions & 0 deletions output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
andouille: 1
bacon: 3
ball: 3
beef: 5
belly: 2
biltong: 1
bresaola: 2
brisket: 1
capicola: 3
chop: 1
chuck: 2
corned: 1
cupim: 3
doner: 2
fatback: 2
filet: 2
flank: 2
frankfurter: 2
ground: 1
ham: 4
hock: 3
jerky: 1
jowl: 1
kevin: 1
kielbasa: 2
landjaeger: 2
loin: 6
meatball: 1
meatloaf: 2
mignon: 2
pancetta: 3
pastrami: 2
picanha: 2
pig: 1
porchetta: 2
pork: 8
prosciutto: 4
ribeye: 1
ribs: 7
round: 1
rump: 1
salami: 1
sausage: 3
shank: 2
shankle: 1
short: 1
shoulder: 2
spare: 3
steak: 4
strip: 4
swine: 1
t-bone: 4
tenderloin: 3
tip: 3
tongue: 3
tri-tip: 1
turducken: 4
venison: 1