| 701 | } |
| 702 | |
| 703 | static napi_value encodeBool(napi_env env, napi_callback_info info) { |
| 704 | size_t argc = 4; |
| 705 | napi_value args[4] = {nullptr}; |
| 706 | NAPI_CALL(napi_get_cb_info(env, info, &argc, args, nullptr, nullptr)); |
| 707 | |
| 708 | auto handle = NValueToUInt64(env, args[0]); |
| 709 | auto key = NValueToString(env, args[1]); |
| 710 | MMKV *kv = reinterpret_cast<MMKV *>(handle); |
| 711 | if (kv && key.length() > 0) { |
| 712 | auto value = NValueToBool(env,args[2]); |
| 713 | if (IsNValueUndefined(env, args[3])) { |
| 714 | auto ret = kv->set(value, key); |
| 715 | return BoolToNValue(env, ret); |
| 716 | } |
| 717 | uint32_t expiration = NValueToUInt32(env, args[3]); |
| 718 | auto ret = kv->set(value, key, expiration); |
| 719 | return BoolToNValue(env, ret); |
| 720 | } |
| 721 | return BoolToNValue(env,false); |
| 722 | } |
| 723 | |
| 724 | static napi_value decodeBool(napi_env env, napi_callback_info info) { |
| 725 | size_t argc = 3; |
nothing calls this directly
no test coverage detected