mod utils;

use wasm_bindgen::prelude::*;

// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
// allocator.
#[cfg(feature = "wee_alloc")]
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;

#[wasm_bindgen]
extern {
    fn alert(s: &str);
}

#[wasm_bindgen]
pub fn calc_fibonacci(n: u64) -> u64 {
    if n <= 1u64 {
        n
    } else {
        calc_fibonacci(n - 1u64) + calc_fibonacci(n - 2u64)
    }
}
