diff --git a/src/commonMain/kotlin/com/insanusmokrassar/sdi/HelperTools.kt b/src/commonMain/kotlin/com/insanusmokrassar/sdi/HelperTools.kt index f746b5c..4686f7a 100644 --- a/src/commonMain/kotlin/com/insanusmokrassar/sdi/HelperTools.kt +++ b/src/commonMain/kotlin/com/insanusmokrassar/sdi/HelperTools.kt @@ -4,4 +4,7 @@ import kotlinx.serialization.ImplicitReflectionSerializer import kotlinx.serialization.json.Json @ImplicitReflectionSerializer -fun loadModule(json: String): Module = Json.nonstrict.parse(ModuleDeserializerStrategy, json) +fun Json.loadModule(json: String): Module = parse(ModuleDeserializerStrategy, json) + +@ImplicitReflectionSerializer +fun loadModule(json: String): Module = Json.nonstrict.loadModule(json) diff --git a/src/jvmMain/kotlin/com/insanusmokrassar/sdi/JVMHelperTools.kt b/src/jvmMain/kotlin/com/insanusmokrassar/sdi/JVMHelperTools.kt index b5c4804..e32d946 100644 --- a/src/jvmMain/kotlin/com/insanusmokrassar/sdi/JVMHelperTools.kt +++ b/src/jvmMain/kotlin/com/insanusmokrassar/sdi/JVMHelperTools.kt @@ -2,10 +2,17 @@ package com.insanusmokrassar.sdi import kotlinx.io.InputStream import kotlinx.serialization.ImplicitReflectionSerializer +import kotlinx.serialization.json.Json import java.io.File @ImplicitReflectionSerializer -fun loadModule(stream: InputStream) = loadModule(stream.reader().readText()) +fun Json.loadModule(stream: InputStream) = loadModule(stream.reader().readText()) @ImplicitReflectionSerializer -fun loadModule(file: File) = loadModule(file.inputStream()) +fun loadModule(stream: InputStream) = Json.nonstrict.loadModule(stream.reader().readText()) + +@ImplicitReflectionSerializer +fun Json.loadModule(file: File) = loadModule(file.inputStream()) + +@ImplicitReflectionSerializer +fun loadModule(file: File) = Json.nonstrict.loadModule(file.inputStream())