├── .gitignore ├── .npmignore ├── index.js ├── number.js └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | node_modules 3 | *.log 4 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.log 3 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | export const sayHello = (name) => { 2 | return `Hello ${name}`; 3 | } 4 | 5 | export const sum = (numbers) => { 6 | let total = 0; 7 | for (const number of numbers) { 8 | total += number; 9 | } 10 | return total; 11 | } 12 | -------------------------------------------------------------------------------- /number.js: -------------------------------------------------------------------------------- 1 | export const min = (first, second) => { 2 | if (first < second) { 3 | return first; 4 | } else { 5 | return second; 6 | } 7 | } 8 | 9 | export const max = (first, second) => { 10 | if (first > second) { 11 | return first; 12 | } else { 13 | return second; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "belajar-nodejs-npm-library-khannedy", 3 | "version": "1.1.0", 4 | "description": "Belajar NodeJS NPM", 5 | "main": "index.js", 6 | "type": "module", 7 | "scripts": { 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | "author": "Eko Kurniawan Khannedy", 11 | "license": "ISC", 12 | "exports": { 13 | ".": "./index.js", 14 | "./number": "./number.js" 15 | } 16 | } 17 | --------------------------------------------------------------------------------