nhb-toolbox
Version:
A versatile collection of smart, efficient, and reusable utility functions and classes for everyday development needs.
31 lines • 1.34 kB
TypeScript
import type { Numeric } from '../types/index';
/**
* * Generates the first `limit` Fibonacci numbers.
*
* @param limit The number of Fibonacci numbers to generate.
* @returns An array containing the first `limit` Fibonacci numbers.
*/
export declare function getFibonacciSeries(limit: Numeric): number[];
/**
* * Generates the first `limit` Fibonacci numbers using recursion with memoization.
*
* @param limit - The number of Fibonacci numbers to generate.
* @returns An array containing the first `limit` Fibonacci numbers.
*/
export declare function getFibonacciSeriesMemo(limit: Numeric): number[];
/**
* * Generator function for Fibonacci sequence up to a given limit.
*
* @param limit - Number of Fibonacci numbers to generate.
* @param onYield - Optional callback triggered on each yield with the current value and index.
* @returns A generator yielding Fibonacci numbers one by one.
*/
export declare function fibonacciGenerator(limit: Numeric, onYield?: (value: number, index: number) => void): Generator<number, void, void>;
/**
* * Calculates the `n`th Fibonacci number using optimized space.
*
* @param index - The index (0-based) of the Fibonacci number.
* @returns The index=`n`th Fibonacci number.
*/
export declare function getNthFibonacci(index: Numeric): number;
//# sourceMappingURL=fibonacci.d.ts.map