From a6c2a87f2cffa5c3b29e76ec40f0081a9332ee16 Mon Sep 17 00:00:00 2001 From: "Brian P. Gallagher" Date: Mon, 2 Jul 2018 16:49:52 -0400 Subject: [PATCH 1/2] part one done --- .gitignore | 2 ++ index.js | 11 ++++++++ lib/logger.js | 14 ++++++++++ lib/salutations.json | 4 +++ package-lock.json | 62 ++++++++++++++++++++++++++++++++++++++++++++ package.json | 23 ++++++++++++++++ 6 files changed, 116 insertions(+) create mode 100644 .gitignore create mode 100644 index.js create mode 100644 lib/logger.js create mode 100644 lib/salutations.json create mode 100644 package-lock.json create mode 100644 package.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..82d30cc --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ + +node_modules/ diff --git a/index.js b/index.js new file mode 100644 index 0000000..ef1510e --- /dev/null +++ b/index.js @@ -0,0 +1,11 @@ +var _ = require('lodash'); +var _chalk = require('chalk'); +var salutations = require('./lib/salutations'); +var logger = require('./lib/logger'); + +console.log(_chalk.blue('Hello world!')); + +_.each(salutations, function(salutation) { + logger.log(salutation); +}); + diff --git a/lib/logger.js b/lib/logger.js new file mode 100644 index 0000000..fab7d5b --- /dev/null +++ b/lib/logger.js @@ -0,0 +1,14 @@ + +var logger = { + log: function(message) { + console.log(message); + } +}; + +var logger = { + log: function(message) { + console.log(message); + } +}; + +module.exports = logger; diff --git a/lib/salutations.json b/lib/salutations.json new file mode 100644 index 0000000..b54035a --- /dev/null +++ b/lib/salutations.json @@ -0,0 +1,4 @@ +{ + "en": "hello world", + "es": "hola mundo" +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..b3becf1 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,62 @@ +{ + "name": "assignment_node_hello_world", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "1.9.2" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "requires": { + "ansi-styles": "3.2.1", + "escape-string-regexp": "1.0.5", + "supports-color": "5.4.0" + } + }, + "color-convert": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.2.tgz", + "integrity": "sha512-3NUJZdhMhcdPn8vJ9v2UQJoH0qqoGUkYTgFEPZaPjEtwmmKUfNV46zZmgB2M5M4DCEQHMaCfWHCxiBflLm04Tg==", + "requires": { + "color-name": "1.1.1" + } + }, + "color-name": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.1.tgz", + "integrity": "sha1-SxQVMEz1ACjqgWQ2Q72C6gWANok=" + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + }, + "lodash": { + "version": "4.17.10", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", + "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==" + }, + "supports-color": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", + "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "requires": { + "has-flag": "3.0.0" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..02b85f2 --- /dev/null +++ b/package.json @@ -0,0 +1,23 @@ +{ + "name": "assignment_node_hello_world", + "version": "1.0.0", + "description": "assignment node hello world", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/bpgallagher/assignment_node_hello_world.git" + }, + "author": "B", + "license": "ISC", + "bugs": { + "url": "https://github.com/bpgallagher/assignment_node_hello_world/issues" + }, + "homepage": "https://github.com/bpgallagher/assignment_node_hello_world#readme", + "dependencies": { + "chalk": "^2.4.1", + "lodash": "^4.17.10" + } +} From 93193cd778af7037657ebe29b86fbd9caedd9cdc Mon Sep 17 00:00:00 2001 From: "Brian P. Gallagher" Date: Mon, 2 Jul 2018 21:50:14 -0400 Subject: [PATCH 2/2] commit --- lib/logger.js | 17 ++++++++--------- salutations.json | 4 ++++ 2 files changed, 12 insertions(+), 9 deletions(-) create mode 100644 salutations.json diff --git a/lib/logger.js b/lib/logger.js index fab7d5b..3fdc976 100644 --- a/lib/logger.js +++ b/lib/logger.js @@ -1,14 +1,13 @@ var logger = { - log: function(message) { - console.log(message); - } -}; - -var logger = { - log: function(message) { - console.log(message); - } + log: function(message, type) { + if (type = "true") { + console.log(_chalk.blue(message + "logged at info level")); + } else if (type = "false") { + console.log(_chalk.yellow(message + "logged at warning level")); + } else if (type = "error") { + console.log(_chalk.red(message + "logged at error level")); + }} }; module.exports = logger; diff --git a/salutations.json b/salutations.json new file mode 100644 index 0000000..b54035a --- /dev/null +++ b/salutations.json @@ -0,0 +1,4 @@ +{ + "en": "hello world", + "es": "hola mundo" +} \ No newline at end of file