UNPKG

math_demo

Version:

An demo of createing a package

43 lines (35 loc) 590 B
var call_counter=require('./call_counter'); function mutiply(x,y) { call_counter(); return x * y; } function divide(x,y) { call_counter(); return x / y; } function fib(count) { call_counter(); return private_fib(count); } function private_fib(count, counter, first, second) { if(count==0) return 0; if(counter==undefined) { counter=1; first=1; second=2; } result=first+second; private_fib(count, ++counter, second,result); return result; } module.exports={ mutiplication:mutiply, division:divide, fibonacci:fib }