Skip to content

Rewrite your app in Rust, piece by piece, checked against the original at every step. Works with TypeScript, JavaScript, Python, Go, Ruby, Java, C, PHP, C#, Kotlin, PowerShell and Swift.

573 B
Raw Blame
//! JS bindings for `packages/core/src/fuzzy.ts`: generated from the signatures in `port.rs` by rust-anything.
//! Regenerate with `rust-anything refresh` after changing them.

use wasm_bindgen::prelude::*;

pub mod port;
pub mod utf16;

/// `fuzzyScore`.
fn fuzzy_score_inner(query: String, text: String) -> Result<f64, String> {
    let out = port::fuzzy_score(query, text);
    Ok(out)
}

#[wasm_bindgen(js_name = "fuzzyScore")]
pub fn fuzzy_score(query: String, text: String) -> Result<f64, JsError> {
    fuzzy_score_inner(query, text).map_err(|e| JsError::new(&e))
}