• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2function fib(n) {
3  if (n === 0 || n === 1) return n;
4  return fib(n - 1) + fib(n - 2);
5}
6
7// This is based on emperial values - in the CI, on Windows the program
8// tend to finish too fast then we won't be able to see the profiled script
9// in the samples, so we need to bump the values a bit. On slower platforms
10// like the Pis it could take more time to complete, we need to use a
11// smaller value so the test would not time out.
12const FIB = process.platform === 'win32' ? 40 : 30;
13
14const n = parseInt(process.env.FIB) || FIB;
15process.stdout.write(`${fib(n)}\n`);
16