diff --git a/README.md b/README.md index b6d4d07..a490ce5 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,8 @@ ### Links and Resources -- [submission PR](https://github.com/wolfes-401-advanced-javascript/notes/pull/1) +- [submission PR 1](https://github.com/wolfes-401-advanced-javascript/notes/pull/1) +- [submission PR 2](https://github.com/wolfes-401-advanced-javascript/notes/pull/2) - [ci/cd](http://xyz.com) (GitHub Actions) - [back-end server url](http://xyz.com) (when applicable) - [front-end application](http://xyz.com) (when applicable) diff --git a/index.js b/index.js index daa3993..9d94e1e 100644 --- a/index.js +++ b/index.js @@ -5,5 +5,6 @@ console.log('App EXISTS'); const Input = require('./lib/input.js'); const Notes = require('./lib/notes.js'); -let parsed = new Input(process.argv.slice(2)); -let notes = new Notes(parsed); \ No newline at end of file + +//let notes = new Notes(parsed); + diff --git a/lib/input.js b/lib/input.js index 66ba4ae..8d7acab 100644 --- a/lib/input.js +++ b/lib/input.js @@ -1,3 +1,18 @@ 'use strict'; -const minimist = require('minimist'); \ No newline at end of file +const minimist = require('minimist'); + +const args = minimist(process.argv.slice(2)); +console.log(args); +let action = (Object.keys(args).slice(1).toString()); +console.log(action); + +class Input { + constructor(args, action) { + this.action = action; + this.payload = args.a; + } +} + +console.log(new Input(args, action)); +module.exports = Input; \ No newline at end of file diff --git a/lib/notes.js b/lib/notes.js index e69de29..4fb54ae 100644 --- a/lib/notes.js +++ b/lib/notes.js @@ -0,0 +1,29 @@ +'use strict'; + +class Notes { + constructor(action, payload) { + this.action = action; + this.payload = payload; + this.id = Math.floor(Math.random()*1000); + } + + execute() { + const action = ['add', 'a']; + switch(action.includes(this.action)) { + case 'add' || 'a': + Notes.add; + break; + + } + } + + add() { + let note = new Notes(this.action, this.payload); + return note; + } +} + + +console.log(new Notes('add', 'testing')); + +module.exports = Notes; \ No newline at end of file