Skip to content

Commit

Permalink
Add: Two-level JS binding
Browse files Browse the repository at this point in the history
  • Loading branch information
ashvardanian committed Oct 2, 2023
1 parent f269582 commit 1218966
Show file tree
Hide file tree
Showing 10 changed files with 672 additions and 661 deletions.
2 changes: 1 addition & 1 deletion docs/compilation.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ WebAssembly:

```sh
emcmake cmake -B ./build -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -s TOTAL_MEMORY=64MB" && emmake make -C ./build
node ./build/test.js
node ./build/usearch.test.js
```

If you don't yet have `emcmake` installed:
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@
breathe_projects = {"USearch": "../build/xml"}
breathe_default_project = "USearch"

js_source_path = "../javascript/docs.js"
js_source_path = "../javascript/usearch.js"
8 changes: 8 additions & 0 deletions include/usearch/index_plugins.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,10 @@ inline expected_gt<scalar_kind_t> scalar_kind_from_name(char const* name, std::s
return parsed;
}

inline expected_gt<scalar_kind_t> scalar_kind_from_name(char const* name) {
return scalar_kind_from_name(name, std::strlen(name));
}

inline expected_gt<metric_kind_t> metric_from_name(char const* name, std::size_t len) {
expected_gt<metric_kind_t> parsed;
if (str_equals(name, len, "l2sq") || str_equals(name, len, "euclidean_sq")) {
Expand All @@ -370,6 +374,10 @@ inline expected_gt<metric_kind_t> metric_from_name(char const* name, std::size_t
return parsed;
}

inline expected_gt<metric_kind_t> metric_from_name(char const* name) {
return metric_from_name(name, std::strlen(name));
}

inline float f16_to_f32(std::uint16_t u16) noexcept {
#if USEARCH_USE_NATIVE_F16
f16_native_t f16;
Expand Down
111 changes: 0 additions & 111 deletions javascript/docs.js

This file was deleted.

Loading

0 comments on commit 1218966

Please sign in to comment.