@polkadot/types-codec 8.7.2-16 → 8.7.2-19
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.
- package/base/Option.js +15 -8
- package/cjs/base/Option.js +15 -8
- package/cjs/packageInfo.js +1 -1
- package/package.json +1 -1
- package/packageInfo.js +1 -1
package/base/Option.js
CHANGED
|
@@ -21,16 +21,23 @@ class None extends Null {
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
function decodeOption(registry, Type, value) {
|
|
24
|
-
|
|
25
|
-
if (value instanceof Option) {
|
|
26
|
-
value = value.value;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (isNull(value) || isUndefined(value) || value === '0x' || value instanceof None) {
|
|
30
|
-
return new None(registry);
|
|
31
|
-
} else if (value instanceof Type) {
|
|
24
|
+
if (value instanceof Type) {
|
|
32
25
|
// don't re-create, use as it (which also caters for derived types)
|
|
33
26
|
return value;
|
|
27
|
+
} else if (value instanceof Option) {
|
|
28
|
+
if (value.value instanceof Type) {
|
|
29
|
+
// same instance, return it
|
|
30
|
+
return value.value;
|
|
31
|
+
} else if (value.isNone) {
|
|
32
|
+
// internal is None, we are also none
|
|
33
|
+
return new None(registry);
|
|
34
|
+
} // convert the actual value into known
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
return new Type(registry, value.value);
|
|
38
|
+
} else if (isNull(value) || isUndefined(value) || value === '0x' || value instanceof None) {
|
|
39
|
+
// anyhting empty we pass as-is
|
|
40
|
+
return new None(registry);
|
|
34
41
|
} else if (isU8a(value)) {
|
|
35
42
|
// the isU8a check happens last in the if-tree - since the wrapped value
|
|
36
43
|
// may be an instance of it, so Type and Option checks go in first
|
package/cjs/base/Option.js
CHANGED
|
@@ -30,16 +30,23 @@ class None extends _Null.Null {
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
function decodeOption(registry, Type, value) {
|
|
33
|
-
|
|
34
|
-
if (value instanceof Option) {
|
|
35
|
-
value = value.value;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if ((0, _util.isNull)(value) || (0, _util.isUndefined)(value) || value === '0x' || value instanceof None) {
|
|
39
|
-
return new None(registry);
|
|
40
|
-
} else if (value instanceof Type) {
|
|
33
|
+
if (value instanceof Type) {
|
|
41
34
|
// don't re-create, use as it (which also caters for derived types)
|
|
42
35
|
return value;
|
|
36
|
+
} else if (value instanceof Option) {
|
|
37
|
+
if (value.value instanceof Type) {
|
|
38
|
+
// same instance, return it
|
|
39
|
+
return value.value;
|
|
40
|
+
} else if (value.isNone) {
|
|
41
|
+
// internal is None, we are also none
|
|
42
|
+
return new None(registry);
|
|
43
|
+
} // convert the actual value into known
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
return new Type(registry, value.value);
|
|
47
|
+
} else if ((0, _util.isNull)(value) || (0, _util.isUndefined)(value) || value === '0x' || value instanceof None) {
|
|
48
|
+
// anyhting empty we pass as-is
|
|
49
|
+
return new None(registry);
|
|
43
50
|
} else if ((0, _util.isU8a)(value)) {
|
|
44
51
|
// the isU8a check happens last in the if-tree - since the wrapped value
|
|
45
52
|
// may be an instance of it, so Type and Option checks go in first
|
package/cjs/packageInfo.js
CHANGED
package/package.json
CHANGED
package/packageInfo.js
CHANGED
|
@@ -5,5 +5,5 @@ export const packageInfo = {
|
|
|
5
5
|
name: '@polkadot/types-codec',
|
|
6
6
|
path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto',
|
|
7
7
|
type: 'esm',
|
|
8
|
-
version: '8.7.2-
|
|
8
|
+
version: '8.7.2-19'
|
|
9
9
|
};
|