Small Enum/EnumType cleanups for consistency (#759)

This commit is contained in:
Jaco Greeff
2019-03-06 12:29:34 +01:00
committed by GitHub
parent 89cd9323e7
commit cc65bb53d6
10 changed files with 39 additions and 32 deletions
+1 -1
View File
@@ -36,6 +36,6 @@
"@polkadot/rpc-rx": "^0.46.4",
"@polkadot/storage": "^0.46.4",
"@polkadot/types": "^0.46.4",
"@polkadot/util-crypto": "^0.35.1"
"@polkadot/util-crypto": "^0.35.4"
}
}
+1 -1
View File
@@ -33,6 +33,6 @@
"@polkadot/jsonrpc": "^0.46.4",
"@polkadot/rpc-provider": "^0.46.4",
"@polkadot/types": "^0.46.4",
"@polkadot/util": "^0.35.1"
"@polkadot/util": "^0.35.4"
}
}
+3 -3
View File
@@ -30,10 +30,10 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
"dependencies": {
"@babel/runtime": "^7.3.4",
"@polkadot/keyring": "^0.35.1",
"@polkadot/keyring": "^0.35.4",
"@polkadot/storage": "^0.46.4",
"@polkadot/util": "^0.35.1",
"@polkadot/util-crypto": "^0.35.1",
"@polkadot/util": "^0.35.4",
"@polkadot/util-crypto": "^0.35.4",
"@types/nock": "^9.3.1",
"eventemitter3": "^3.1.0",
"isomorphic-fetch": "^2.2.1",
+1 -1
View File
@@ -12,6 +12,6 @@
"dependencies": {
"@babel/runtime": "^7.3.4",
"@polkadot/types": "^0.46.4",
"@polkadot/util": "^0.35.1"
"@polkadot/util": "^0.35.4"
}
}
+3 -3
View File
@@ -30,9 +30,9 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-storage#readme",
"dependencies": {
"@babel/runtime": "^7.3.4",
"@polkadot/keyring": "^0.35.1",
"@polkadot/keyring": "^0.35.4",
"@polkadot/types": "^0.46.4",
"@polkadot/util": "^0.35.1",
"@polkadot/util-crypto": "^0.35.1"
"@polkadot/util": "^0.35.4",
"@polkadot/util-crypto": "^0.35.4"
}
}
+2 -2
View File
@@ -30,8 +30,8 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme",
"dependencies": {
"@babel/runtime": "^7.3.4",
"@polkadot/keyring": "^0.35.1",
"@polkadot/util": "^0.35.1",
"@polkadot/keyring": "^0.35.4",
"@polkadot/util": "^0.35.4",
"core-js": "^2.6.5"
}
}
+7
View File
@@ -65,6 +65,13 @@ export default class Enum extends Base<number> implements Codec {
return 1;
}
/**
* @description Returns the index for this value (equivalent to toNumber)
*/
get index (): number {
return this.raw;
}
/**
* @description Checks if the value is an empty value (always false)
*/
+1 -1
View File
@@ -133,7 +133,7 @@ export default class EnumType<T> extends Base<Codec> implements Codec {
* @description Checks if the Enum points to a [[Null]] type
*/
get isNone (): boolean {
return this.raw instanceof Null;
return this.isNull;
}
/**