-
Notifications
You must be signed in to change notification settings - Fork 12
pushing up my completed lab #10
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| 'use strict'; | ||
|
|
||
| const greet = require('./lib/greet.js'); | ||
| greet.greet('Evan'); | ||
|
|
||
|
|
||
| // COMMAND LINE UTILITY - EXTRA CREDIT | ||
| const clArgument = process.argv[2]; | ||
| console.log(`Hey there from the ${clArgument}`); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| 'use strict'; | ||
|
|
||
| module.exports = exports = {}; | ||
|
|
||
| exports.greet = function(name) { | ||
| console.log(`hello ${name}`); | ||
| return `hello ${name}`; | ||
| }; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since you are only exporting a single method, it's not necessary to use module.exports = exports = { } It would be more appropriate to use module.exports = { } since greet.js is only exporting a single method :) For instance, if you were to attach another function the exports objects, then using module.exports the way you have on line 3 would be fine. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| 'use strict'; | ||
|
|
||
| const greet = require('../lib/greet.js'); | ||
| const assert = require('assert'); | ||
|
|
||
| describe('Greet module', function() { | ||
| describe('#greet()', function() { | ||
| it('should return hey plus the name passed in', function() { | ||
| let greetingString = greet.greet('Evan'); | ||
| assert.ok(greetingString === 'hello Evan', 'string does not match hello Evan'); | ||
| }); | ||
| }); | ||
| }); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Test looks good! |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Glad to see you used process.argv[2] to do the bonus!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since process.argv[2] is generated dynamically, it would be more appropriate to use the var key word. Const implies that a variable will not be reassigned, thus it will remain constant throughout the program.