| 17 | static void external_buffer_cleanup(napi_env env, void *data, void *hint) { free(data); } |
| 18 | |
| 19 | static napi_value makeFindResultObject(napi_env env, int64_t index, uint64_t length) { |
| 20 | napi_value js_obj; |
| 21 | napi_create_object(env, &js_obj); |
| 22 | |
| 23 | napi_value js_index; |
| 24 | if (index < 0) napi_create_bigint_int64(env, -1, &js_index); |
| 25 | else |
| 26 | napi_create_bigint_uint64(env, (uint64_t)index, &js_index); |
| 27 | |
| 28 | napi_value js_length; |
| 29 | napi_create_bigint_uint64(env, (uint64_t)length, &js_length); |
| 30 | |
| 31 | napi_set_named_property(env, js_obj, "index", js_index); |
| 32 | napi_set_named_property(env, js_obj, "length", js_length); |
| 33 | |
| 34 | return js_obj; |
| 35 | } |
| 36 | |
| 37 | napi_value indexOfAPI(napi_env env, napi_callback_info info) { |
| 38 | size_t argc = 2; |
no outgoing calls
no test coverage detected
searching dependent graphs…