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

finished assignment #80

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
assignment_node_hello_world
===========================

By Brennan Fulmer

Just Node.js saying hello to the world and such.




In this assignment I learned the basics of Node and used Lodash and Chalk to display a series of error messages
21 changes: 21 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

const chalk = require("chalk");
var _ = require("lodash");
var logger = require("./lib/logger");
var record = require("./data/logs");

console.log("Hello World!");
console.log(chalk.red("chalk"));
console.log(_.name);

_.each([1, 2, 3], function(value) {
console.log(value);
});

logger.log("test", "info");
logger.log("123", "warning");
logger.log("abc", "error");

_.each(record, function(value) {
logger.log(value.message, value.level);
});
28 changes: 28 additions & 0 deletions lib/logger.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

const chalk = require("chalk");

var logger = {
log: function(message, level) {
if (level == "info") {
this.info(message);
} else if (level == "warning") {
this.warning(message);
} else if (level == "error") {
this.error(message);
}
},

info: function(message) {
console.log(chalk.blue(message));
},

warning: function(message) {
console.log(chalk.yellow(message));
},

error: function(message) {
console.log(chalk.red(message));
}
};

module.exports = logger;
62 changes: 62 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "hello_world",
"version": "1.0.0",
"description": "Node_Hello_World",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/BrennanFulmer/assignment_node_hello_world.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/BrennanFulmer/assignment_node_hello_world/issues"
},
"homepage": "https://github.com/BrennanFulmer/assignment_node_hello_world#readme",
"dependencies": {
"chalk": "^2.3.1",
"lodash": "^4.17.5"
}
}