package io.scanbot.sdk.capacitor import com.getcapacitor.JSArray import com.getcapacitor.JSObject import com.getcapacitor.PluginCall fun PluginCall.asJsonOrReject(key: String): JSObject? { return this.getObject(key) ?: run { this.reject(ScanbotSDKCapacitorPlugin.missingRequiredPropertyErrorMsg + key) return null } } fun PluginCall.asStringOrReject(key: String): String? { return this.getString(key) ?: run { this.reject(ScanbotSDKCapacitorPlugin.missingRequiredPropertyErrorMsg + key) return null } } fun PluginCall.asIntOrReject(key: String): Int? { return this.getInt(key) ?: run { this.reject(ScanbotSDKCapacitorPlugin.missingRequiredPropertyErrorMsg + key) return null } } fun PluginCall.asDoubleOrReject(key: String): Double? { return this.getDouble(key) ?: run { this.reject(ScanbotSDKCapacitorPlugin.missingRequiredPropertyErrorMsg + key) return null } } fun PluginCall.asArrayOrReject(key: String): JSArray? { return this.getArray(key) ?: run { this.reject(ScanbotSDKCapacitorPlugin.missingRequiredPropertyErrorMsg + key) return null } }