@barguide/template
Version:
TypeScript | Template
47 lines (43 loc) • 1.02 kB
JavaScript
/**
* @name addition
* @description A very simple function that adds two numbers
* @param a {number}
* @param b {number}
*/
const addition = (a, b) => a + b;
/**
* @name addition
* @description A very simple function that subtracts two numbers
* @param a {number}
* @param b {number}
*/
const subtraction = (a, b) => a - b;
/**
* @name Calculator
* @description tbd...
*/
class Calculator {
constructor(opts) {
const { debug } = opts;
this.debug = debug;
}
logger(message) {
// eslint-disable-next-line no-console
if (this.debug)
console.log(message);
}
}
Calculator.addition = addition;
Calculator.subtraction = subtraction;
const myLib = {
calculator: new Calculator({
debug: false,
testing: false
}),
numberOfGreetings: 0,
makeGreeting(str) {
this.numberOfGreetings += 1;
return `${this.numberOfGreetings}: ${str}`;
}
};
export { Calculator, myLib };