| 1002 | } |
| 1003 | |
| 1004 | static napi_value decodeString(napi_env env, napi_callback_info info) { |
| 1005 | size_t argc = 3; |
| 1006 | napi_value args[3] = {nullptr}; |
| 1007 | NAPI_CALL(napi_get_cb_info(env, info, &argc, args, nullptr, nullptr)); |
| 1008 | |
| 1009 | auto handle = NValueToUInt64(env, args[0]); |
| 1010 | auto key = NValueToString(env, args[1]); |
| 1011 | MMKV *kv = reinterpret_cast<MMKV *>(handle); |
| 1012 | if (kv && key.length() > 0) { |
| 1013 | string result; |
| 1014 | if (kv->getString(key, result)) { |
| 1015 | return StringToNValue(env, result); |
| 1016 | } |
| 1017 | } |
| 1018 | return args[2]; |
| 1019 | } |
| 1020 | |
| 1021 | static napi_value encodeStringSet(napi_env env, napi_callback_info info) { |
| 1022 | size_t argc = 4; |
nothing calls this directly
no test coverage detected