Skip to content

Commit

Permalink
Now supporting arrays.
Browse files Browse the repository at this point in the history
  • Loading branch information
thekevinbrown committed Apr 16, 2019
1 parent 5c0840b commit 2e30cb7
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/contracts/typeGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,22 @@ type GeneratorLevel = Array<string | IndentedGeneratorLevel>;

// Everything is a string right now.
const mapParameterType = (eosType: string) => {
switch (eosType) {
const wrapper = eosType.endsWith('[]') ? 'Array' : undefined;
let type;

switch (eosType.replace('[]', '')) {
case 'bool':
return 'boolean';
type = 'boolean';
break;
default:
return 'string';
type = 'string';
break;
}

if (wrapper) {
return `${wrapper}<${type}>`;
} else {
return type;
}
};

Expand Down

0 comments on commit 2e30cb7

Please sign in to comment.