From a9af48ba325952dafa48f4b80642ff076e8354ae Mon Sep 17 00:00:00 2001 From: Anartz Mugika Date: Sat, 2 Mar 2019 17:57:25 +0100 Subject: [PATCH] Primera version del modulo de matematicas basica OK --- index.js | 43 +++++++++++++++++++++++++++++++++++++++++++ package.json | 28 ++++++++++++++++++++++++++++ pruebas.js | 10 ++++++++++ 3 files changed, 81 insertions(+) create mode 100644 index.js create mode 100644 package.json create mode 100644 pruebas.js diff --git a/index.js b/index.js new file mode 100644 index 0000000..abe079c --- /dev/null +++ b/index.js @@ -0,0 +1,43 @@ +module.exports = { + /** + * Suma de dos numeros + * @example + * n1 = 1 , n2 = 3 = > resultado 4 + * @param {*} n1 Numero uno de la suma + * @param {*} n2 Numero dos de la suma + */ + suma: function (n1, n2) { + return n1 + n2; + }, + /** + * Resta de dos numeros + * @example + * n1 = 1 , n2 = 3 = > resultado -2 + * @param {*} n1 Numero uno de la resta + * @param {*} n2 Numero dos de la resta + */ + resta: function (n1, n2) { + return n1 - n2; + }, + /** + * Multiplicacion de dos numeros + * @example + * n1 = 1 , n2 = 3 = > resultado 3 + * @param {*} n1 Numero uno de la multiplicacion + * @param {*} n2 Numero dos de la multiplicacion + */ + multiplicacion: function (n1, n2) { + return n1 * n2; + }, + /** + * Division de dos numeros + * @example + * n1 = 1 , n2 = 3 = > resultado 0.33 + * @param {*} n1 Numero uno de la Division + * @param {*} n2 Numero dos de la Division + */ + division: function (n1, n2) { + return n1 / n2; + } +} + diff --git a/package.json b/package.json new file mode 100644 index 0000000..2dd3f19 --- /dev/null +++ b/package.json @@ -0,0 +1,28 @@ +{ + "name": "proyecto-1a-matematicas", + "version": "1.0.0", + "description": "Proyecto de matemáticas sencillo para aprender NodeJS y subirlo a NPM", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/npm-js-ts-angular-modules-course/proyecto-1a-matematicas.git" + }, + "keywords": [ + "math", + "matematica", + "suma", + "resta", + "division", + "multi", + "basico" + ], + "author": "Anartz Mugika ", + "license": "MIT", + "bugs": { + "url": "https://github.com/npm-js-ts-angular-modules-course/proyecto-1a-matematicas/issues" + }, + "homepage": "https://github.com/npm-js-ts-angular-modules-course/proyecto-1a-matematicas#readme" +} diff --git a/pruebas.js b/pruebas.js new file mode 100644 index 0000000..9f707b2 --- /dev/null +++ b/pruebas.js @@ -0,0 +1,10 @@ +const m = require('.'); + +console.log(m.suma(1,2)); + +console.log(m.suma(1,2)); + +console.log(m.resta(11,24)); +console.log(m.resta(1,2)); +console.log(m.multiplicacion(1,24)); +console.log(m.multiplicacion(1,2)); \ No newline at end of file