Skip to content

Commit

Permalink
fix: Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mrousavy committed Mar 15, 2022
1 parent f442525 commit 619f477
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
19 changes: 6 additions & 13 deletions ios/JSIUtils.mm
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,13 @@
return jsi::Value::undefined();
}

id convertJSIValueToObjCObject(
jsi::Runtime &runtime,
const jsi::Value &value);
id convertJSIValueToObjCObject(jsi::Runtime &runtime, const jsi::Value &value);
NSString *convertJSIStringToNSString(jsi::Runtime &runtime, const jsi::String &value)
{
return [NSString stringWithUTF8String:value.utf8(runtime).c_str()];
}

NSArray *convertJSIArrayToNSArray(
jsi::Runtime &runtime,
NSArray *convertJSIArrayToNSArray(jsi::Runtime &runtime,
const jsi::Array &value)
{
size_t size = value.size(runtime);
Expand All @@ -97,8 +94,7 @@ id convertJSIValueToObjCObject(
return [result copy];
}

NSDictionary *convertJSIObjectToNSDictionary(
jsi::Runtime &runtime,
NSDictionary *convertJSIObjectToNSDictionary(jsi::Runtime &runtime,
const jsi::Object &value)
{
jsi::Array propertyNames = value.getPropertyNames(runtime);
Expand All @@ -115,8 +111,7 @@ id convertJSIValueToObjCObject(
return [result copy];
}

RCTResponseSenderBlock convertJSIFunctionToCallback(
jsi::Runtime &runtime,
RCTResponseSenderBlock convertJSIFunctionToCallback(jsi::Runtime &runtime,
const jsi::Function &value)
{
__block auto cb = value.getFunction(runtime);
Expand All @@ -126,8 +121,7 @@ RCTResponseSenderBlock convertJSIFunctionToCallback(
};
}

id convertJSIValueToObjCObject(
jsi::Runtime &runtime,
id convertJSIValueToObjCObject(jsi::Runtime &runtime,
const jsi::Value &value)
{
if (value.isUndefined() || value.isNull()) {
Expand Down Expand Up @@ -170,8 +164,7 @@ id convertJSIValueToObjCObject(
reject_.call(runtime_, error);
}

jsi::Value createPromiseAsJSIValue(
jsi::Runtime &rt,
jsi::Value createPromiseAsJSIValue(jsi::Runtime &rt,
const PromiseSetupFunctionType func) {
jsi::Function JSPromise = rt.global().getPropertyAsFunction(rt, "Promise");
jsi::Function fn = jsi::Function::createFromHostFunction(
Expand Down
5 changes: 4 additions & 1 deletion ios/MmkvModule.mm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ @implementation MmkvModule

RCT_EXPORT_MODULE(MMKV)

+ (NSString*)getPropertyAsStringOrNilFromObject:(jsi::Object&)object propertyName:(std::string)propertyName runtime:(jsi::Runtime&)runtime {
+ (NSString*)getPropertyAsStringOrNilFromObject:(jsi::Object&)object
propertyName:(std::string)propertyName
runtime:(jsi::Runtime&)runtime
{
jsi::Value value = object.getProperty(runtime, propertyName.c_str());
std::string string = value.isString() ? value.asString(runtime).utf8(runtime) : "";
return string.length() > 0 ? [NSString stringWithUTF8String:string.c_str()] : nil;
Expand Down

0 comments on commit 619f477

Please sign in to comment.