Skip to content

Commit

Permalink
support array types & webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
gsgalloway committed Aug 10, 2021
1 parent 8f0ead2 commit 144ba5a
Show file tree
Hide file tree
Showing 9 changed files with 4,434 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ yarn-error.log*
lerna-debug.log*
.vscode
.idea
dist
9 changes: 9 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ const types = {
string: {
type: "string",
},

array: {
type: "array"
},
};

const typesRegex = {
Expand All @@ -54,6 +58,11 @@ const typesRegex = {
};

function mapType(type) {
if (type.endsWith(']')) {
const withoutArray = type.substr(0, type.indexOf('['));
const itemType = mapType(withoutArray);
return merge(true, types.array, {items: itemType});
}
const mapped = types[type];
if (mapped) {
return merge(true, mapped);
Expand Down
Loading

0 comments on commit 144ba5a

Please sign in to comment.