refactor: custom vararg
This commit is contained in:
parent
76a354bab6
commit
2ea4780259
|
@ -60,9 +60,16 @@ const Invocation = ({
|
|||
/>
|
||||
);
|
||||
}
|
||||
const j = description.vararg ? Math.min(description?.args?.length - 1, i) : i;
|
||||
const options = description?.args?.[j].options;
|
||||
const type = description?.args?.[j].type || 'undefined';
|
||||
let darg;
|
||||
if ('function' === typeof description?.args) {
|
||||
darg = description?.args(i);
|
||||
}
|
||||
else {
|
||||
const j = description.vararg ? i % description?.args?.length : i;
|
||||
darg = description?.args?.[j];
|
||||
}
|
||||
const {options} = darg;
|
||||
const type = darg.type || 'undefined';
|
||||
return (
|
||||
<Variant
|
||||
context={context}
|
||||
|
@ -73,7 +80,7 @@ const Invocation = ({
|
|||
value={arg}
|
||||
vararg={
|
||||
'undefined' === type
|
||||
|| (description.vararg && j === description?.args?.length - 1)
|
||||
|| description.vararg
|
||||
}
|
||||
/>
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue
Block a user