Permalink
Browse files

Use path.join instead of concating directories.

  • Loading branch information...
1 parent 4d971dd commit 20f2090629d1a8d8fc98ddb5f085bfd770ea1846 @brianloveswords brianloveswords committed Apr 23, 2013
Showing with 7 additions and 4 deletions.
  1. +7 −4 lib/phrases/index.js
View
@@ -1,14 +1,16 @@
+const path = require('path');
+const sandwich = require('sandwich');
+const fs = require('fs');
+
function fileToArray(file) {
return (
- fs.readFileSync(__dirname + '/' +file)
+ fs.readFileSync(path.join(__dirname, '/', file))
.toString()
.trim()
.split('\n')
);
}
-const sandwich = require('sandwich');
-const fs = require('fs');
const ADVERBS = fileToArray('adverbs.txt');
const ADJECTIVES = fileToArray('adjectives.txt');
const NOUNS = fileToArray('nouns.txt');
@@ -27,6 +29,7 @@ function phrases(count) {
}
}
return results;
-};
+}
+
phrases.iterator = iterator;
module.exports = phrases;

0 comments on commit 20f2090

Please sign in to comment.