| 821 | } |
| 822 | |
| 823 | static napi_value encodeInt64(napi_env env, napi_callback_info info) { |
| 824 | size_t argc = 4; |
| 825 | napi_value args[4] = {nullptr}; |
| 826 | NAPI_CALL(napi_get_cb_info(env, info, &argc, args, nullptr, nullptr)); |
| 827 | |
| 828 | auto handle = NValueToUInt64(env, args[0]); |
| 829 | auto key = NValueToString(env, args[1]); |
| 830 | MMKV *kv = reinterpret_cast<MMKV *>(handle); |
| 831 | if (kv && key.length() > 0) { |
| 832 | auto value = NValueToInt64(env, args[2]); |
| 833 | if (IsNValueUndefined(env, args[3])) { |
| 834 | auto ret = kv->set(value, key); |
| 835 | return BoolToNValue(env, ret); |
| 836 | } |
| 837 | uint32_t expiration = NValueToUInt32(env, args[3]); |
| 838 | auto ret = kv->set(value, key, expiration); |
| 839 | return BoolToNValue(env, ret); |
| 840 | } |
| 841 | return BoolToNValue(env, false); |
| 842 | } |
| 843 | |
| 844 | static napi_value decodeInt64(napi_env env, napi_callback_info info) { |
| 845 | size_t argc = 3; |
nothing calls this directly
no test coverage detected