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..3fdc976 --- /dev/null +++ b/lib/logger.js @@ -0,0 +1,13 @@ + +var logger = { + 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/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" + } +} 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