UNPKG

juanhiennvdm_math_example

Version:

An example of creating a package

45 lines (32 loc) 743 B
var call_counter = require('./advanced_math.js'); function multiply(x, y) { call_counter(); return x * y; }; function divide(x, y) { call_counter(); return x / y; }; function fibo(count) { call_counter(); return private_fibo(count); }; function private_fibo(count, firts, second) { if (count == 0) return 0; if (counter == undefined) { count = 1; firts = 1; second = 2; }; result = firts + second; if (counter == count) return result; private_fibo(count, ++counter, second, result); return result; }; module.exports = { multiplication: multiply, division: divide, fibonacci: fibo };