@lppedd/kotlinx-charset 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -25,8 +25,14 @@ export declare interface XCharsetEncoder {
|
|
|
25
25
|
readonly "com.lppedd.kotlinx.charset.exported.XCharsetEncoder": unique symbol;
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
+
export declare interface DecodeOptions {
|
|
29
|
+
readonly replacement?: Nullable<string>;
|
|
30
|
+
}
|
|
31
|
+
export declare interface EncodeOptions {
|
|
32
|
+
readonly replacement?: Nullable<Uint8Array>;
|
|
33
|
+
}
|
|
28
34
|
export declare function getCharsetOrNull(charsetName: string): Nullable<XCharset>;
|
|
29
35
|
export declare function getCharset(charsetName: string): XCharset;
|
|
30
36
|
export declare function getCharsets(): Array<XCharset>;
|
|
31
|
-
export declare function decode(charsetName: string, bytes: Uint8Array): string;
|
|
32
|
-
export declare function encode(charsetName: string, value: string): Uint8Array;
|
|
37
|
+
export declare function decode(charsetName: string, bytes: Uint8Array, options?: Nullable<DecodeOptions>): string;
|
|
38
|
+
export declare function encode(charsetName: string, value: string, options?: Nullable<EncodeOptions>): Uint8Array;
|
|
@@ -6890,15 +6890,24 @@ function getCharsets() {
|
|
|
6890
6890
|
}
|
|
6891
6891
|
return tmp_1;
|
|
6892
6892
|
}
|
|
6893
|
-
function decode(charsetName, bytes) {
|
|
6893
|
+
function decode(charsetName, bytes, options) {
|
|
6894
|
+
options = options === VOID ? null : options;
|
|
6894
6895
|
var charset = registrar.ib(charsetName);
|
|
6895
6896
|
var decoder = charset.yb();
|
|
6897
|
+
if (!(options == null) && isNotUndefined(options, 'replacement')) {
|
|
6898
|
+
decoder.zf(options.replacement);
|
|
6899
|
+
}
|
|
6896
6900
|
var byteArray = toByteArray(bytes);
|
|
6897
6901
|
return decoder.xf(byteArray);
|
|
6898
6902
|
}
|
|
6899
|
-
function encode_0(charsetName, value) {
|
|
6903
|
+
function encode_0(charsetName, value, options) {
|
|
6904
|
+
options = options === VOID ? null : options;
|
|
6900
6905
|
var charset = registrar.ib(charsetName);
|
|
6901
6906
|
var encoder = charset.zb();
|
|
6907
|
+
if (!(options == null) && isNotUndefined(options, 'replacement')) {
|
|
6908
|
+
var tmp0_safe_receiver = options.replacement;
|
|
6909
|
+
encoder.fg(tmp0_safe_receiver == null ? null : toByteArray(tmp0_safe_receiver));
|
|
6910
|
+
}
|
|
6902
6911
|
var byteArray = encoder.eg(value);
|
|
6903
6912
|
return toUint8Array(byteArray);
|
|
6904
6913
|
}
|
|
@@ -6907,6 +6916,9 @@ function initCharsetRegistrar() {
|
|
|
6907
6916
|
provideCharsets(registrar);
|
|
6908
6917
|
return registrar;
|
|
6909
6918
|
}
|
|
6919
|
+
function isNotUndefined(value, prop) {
|
|
6920
|
+
return typeof value[prop] !== 'undefined';
|
|
6921
|
+
}
|
|
6910
6922
|
//region block: post-declaration
|
|
6911
6923
|
initMetadataForInterface(CharSequence, 'CharSequence');
|
|
6912
6924
|
initMetadataForInterface(Comparable, 'Comparable');
|
|
@@ -6927,12 +6939,12 @@ initMetadataForObject(Unit, 'Unit');
|
|
|
6927
6939
|
initMetadataForClass(AbstractCollection, 'AbstractCollection', VOID, VOID, [Collection]);
|
|
6928
6940
|
initMetadataForClass(AbstractMutableCollection, 'AbstractMutableCollection', VOID, VOID, [AbstractCollection, Collection]);
|
|
6929
6941
|
initMetadataForClass(IteratorImpl, 'IteratorImpl');
|
|
6930
|
-
initMetadataForClass(AbstractMutableList, 'AbstractMutableList', VOID, VOID, [AbstractMutableCollection,
|
|
6942
|
+
initMetadataForClass(AbstractMutableList, 'AbstractMutableList', VOID, VOID, [AbstractMutableCollection, KtList, Collection]);
|
|
6931
6943
|
initMetadataForClass(AbstractMap, 'AbstractMap', VOID, VOID, [KtMap]);
|
|
6932
6944
|
initMetadataForClass(AbstractMutableMap, 'AbstractMutableMap', VOID, VOID, [AbstractMap, KtMap]);
|
|
6933
6945
|
initMetadataForClass(AbstractMutableSet, 'AbstractMutableSet', VOID, VOID, [AbstractMutableCollection, KtSet, Collection]);
|
|
6934
6946
|
initMetadataForCompanion(Companion_1);
|
|
6935
|
-
initMetadataForClass(ArrayList, 'ArrayList', ArrayList.a1, VOID, [AbstractMutableList,
|
|
6947
|
+
initMetadataForClass(ArrayList, 'ArrayList', ArrayList.a1, VOID, [AbstractMutableList, KtList, Collection]);
|
|
6936
6948
|
initMetadataForClass(HashMap, 'HashMap', HashMap.v4, VOID, [AbstractMutableMap, KtMap]);
|
|
6937
6949
|
initMetadataForClass(HashMapValues, 'HashMapValues', VOID, VOID, [Collection, AbstractMutableCollection]);
|
|
6938
6950
|
initMetadataForClass(HashMapEntrySetBase, 'HashMapEntrySetBase', VOID, VOID, [KtSet, Collection, AbstractMutableSet]);
|