| 1019 | } |
| 1020 | |
| 1021 | static napi_value encodeStringSet(napi_env env, napi_callback_info info) { |
| 1022 | size_t argc = 4; |
| 1023 | napi_value args[4] = {nullptr}; |
| 1024 | NAPI_CALL(napi_get_cb_info(env, info, &argc, args, nullptr, nullptr)); |
| 1025 | |
| 1026 | auto handle = NValueToUInt64(env, args[0]); |
| 1027 | auto key = NValueToString(env, args[1]); |
| 1028 | MMKV *kv = reinterpret_cast<MMKV *>(handle); |
| 1029 | if (kv && key.length() > 0) { |
| 1030 | auto value = NValueToStringArray(env, args[2]); |
| 1031 | if (IsNValueUndefined(env, args[3])) { |
| 1032 | auto ret = kv->set(value, key); |
| 1033 | return BoolToNValue(env, ret); |
| 1034 | } |
| 1035 | uint32_t expiration = NValueToUInt32(env, args[3]); |
| 1036 | auto ret = kv->set(value, key, expiration); |
| 1037 | return BoolToNValue(env, ret); |
| 1038 | } |
| 1039 | return BoolToNValue(env, false); |
| 1040 | } |
| 1041 | |
| 1042 | static napi_value decodeStringSet(napi_env env, napi_callback_info info) { |
| 1043 | size_t argc = 3; |
nothing calls this directly
no test coverage detected