Rename Struct.get to .getAtIndex (#310)

* Rename to getAtIndex

* Fix lint
This commit is contained in:
Amaury Martiny
2018-10-17 12:29:53 +02:00
committed by GitHub
parent e5b71a3020
commit 94a202f33e
6 changed files with 20 additions and 20 deletions
+2 -2
View File
@@ -94,11 +94,11 @@ export class OuterEventMetadataEvent extends Tuple {
}
get events (): Vector<EventMetadata> {
return this.get(1) as Vector<EventMetadata>;
return this.getAtIndex(1) as Vector<EventMetadata>;
}
get name (): Text {
return this.get(0) as Text;
return this.getAtIndex(0) as Text;
}
}
+3 -3
View File
@@ -125,15 +125,15 @@ export default class Method extends Struct {
}
get args (): Array<Base> {
return (this.get(1) as Struct<Base>).values();
return (this.getAtIndex(1) as Struct<Base>).values();
}
get callIndex (): Uint8Array {
return (this.get(0) as MethodIndex).callIndex;
return (this.getAtIndex(0) as MethodIndex).callIndex;
}
get data (): Uint8Array {
return (this.get(1) as Struct<Base>).toU8a();
return (this.getAtIndex(1) as Struct<Base>).toU8a();
}
get meta (): FunctionMetadata {
+1 -1
View File
@@ -124,7 +124,7 @@ export default class Struct<
}, 0);
}
get (index: number): Base {
getAtIndex (index: number): Base {
return this.values()[index];
}
+3 -3
View File
@@ -58,8 +58,8 @@ describe('Tuple', () => {
threshold: VoteThreshold
}))('0x62190000000000000003507b0a092230783432223a202230783433220a7d0a01');
expect(test.get(0).toNumber()).toEqual(6498);
expect(test.get(1).callIndex).toEqual(new Uint8Array([0, 3]));
expect(test.get(2).toNumber()).toEqual(1);
expect(test.getAtIndex(0).toNumber()).toEqual(6498);
expect(test.getAtIndex(1).callIndex).toEqual(new Uint8Array([0, 3]));
expect(test.getAtIndex(2).toNumber()).toEqual(1);
});
});
+3 -3
View File
@@ -53,9 +53,9 @@ describe('Vector', () => {
]));
const first = test.get(0);
expect(first.get(0).toNumber()).toEqual(10);
expect(first.get(1).callIndex).toEqual(new Uint8Array([0, 3]));
expect(first.get(2).toString()).toEqual('5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ');
expect(first.getAtIndex(0).toNumber()).toEqual(10);
expect(first.getAtIndex(1).callIndex).toEqual(new Uint8Array([0, 3]));
expect(first.getAtIndex(2).toString()).toEqual('5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ');
});
describe('array-like functions', () => {