UNPKG

hq-test

Version:

Automatically generate test code based on test parameters

23 lines (22 loc) 516 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.fibonacci = void 0; function fibonacci(n) { if (typeof n !== 'number') { throw new Error('n should be a Number'); } if (n < 0) { throw new Error('n should >= 0'); } if (n > 10) { throw new Error('n should <= 10'); } if (n === 0) { return 0; } if (n === 1) { return 1; } return fibonacci(n - 1) + fibonacci(n - 2); } exports.fibonacci = fibonacci;