Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.

Commit 712d70b

Browse files
committed
chore: reformat and optimization
- removed all i18n constructs (was experimental) - updated kdocs - added licence headers - updated README.md
1 parent 7c0b0aa commit 712d70b

10 files changed

Lines changed: 309 additions & 188 deletions

File tree

README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,25 @@
1-
# Kotlin Partial Encoding Decoding (KPED)
1+
# Kotlin Partial Encoding Decoding (KPED) [![](https://jitpack.io/v/org.cufy/kped.svg)](https://jitpack.io/#org.cufy/kped)
2+
3+
Serialization Extensions and Serializers for enhancing partial encoding and decoding
4+
that uses no object mapping.
5+
6+
### Install
7+
8+
The main way of installing this library is
9+
using `jitpack.io`
10+
11+
```kts
12+
repositories {
13+
// ...
14+
mavenCentral()
15+
maven("https://jitpack.io")
16+
}
17+
18+
dependencies {
19+
// Replace TAG with the desired version
20+
implementation("org.cufy.kped:bson:TAG")
21+
implementation("org.cufy.kped:json:TAG")
22+
implementation("org.cufy.kped:kped-core:TAG")
23+
implementation("org.cufy.kped:kped-bson:TAG")
24+
}
25+
```

bson/src/commonMain/kotlin/I18n.kt

Lines changed: 0 additions & 70 deletions
This file was deleted.

bson/src/jvmMain/kotlin/I18n-jvm.kt

Lines changed: 0 additions & 77 deletions
This file was deleted.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,70 @@
1+
/*
2+
* Copyright 2023 cufy.org and meemer.com
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
package org.cufy.json
217

318
import kotlinx.serialization.json.JsonArray
419
import kotlinx.serialization.json.JsonElement
520
import kotlinx.serialization.json.JsonObject
621

22+
/**
23+
* A map containing only items of type [JsonElement].
24+
*
25+
* @since 2.0.0
26+
*/
727
typealias JsonObjectLike = Map<String, JsonElement>
28+
29+
/**
30+
* A mutable map containing only items of type [JsonElement].
31+
*
32+
* @since 2.0.0
33+
*/
834
typealias MutableJsonObjectLike = MutableMap<String, JsonElement>
935

36+
/**
37+
* A list containing only items of type [JsonElement].
38+
*
39+
* @since 2.0.0
40+
*/
1041
typealias JsonArrayLike = Iterable<JsonElement>
42+
43+
/**
44+
* A mutable list containing only items of type [JsonElement].
45+
*
46+
* @since 2.0.0
47+
*/
1148
typealias MutableJsonArrayLike = MutableList<JsonElement>
1249

50+
/**
51+
* Construct a new json object using the given [block].
52+
*
53+
* **Warning: mutating the instance provided by the
54+
* given [block] after the execution of this
55+
* function will result to an undefined behaviour.**
56+
*/
1357
fun JsonObject(block: MutableJsonObjectLike.() -> Unit): JsonObject {
1458
return JsonObject(buildMap(block))
1559
}
1660

61+
/**
62+
* Construct a new json array using the given [block].
63+
*
64+
* **Warning: mutating the instance provided by the
65+
* given [block] after the execution of this
66+
* function will result to an undefined behaviour.**
67+
*/
1768
fun JsonArray(block: MutableJsonArrayLike.() -> Unit): JsonArray {
1869
return JsonArray(buildList(block))
1970
}

0 commit comments

Comments
 (0)