refactor: custom vararg

This commit is contained in:
cha0s 2021-02-01 21:56:53 -06:00
parent 76a354bab6
commit 2ea4780259

View File

@ -60,9 +60,16 @@ const Invocation = ({
/> />
); );
} }
const j = description.vararg ? Math.min(description?.args?.length - 1, i) : i; let darg;
const options = description?.args?.[j].options; if ('function' === typeof description?.args) {
const type = description?.args?.[j].type || 'undefined'; 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 ( return (
<Variant <Variant
context={context} context={context}
@ -73,7 +80,7 @@ const Invocation = ({
value={arg} value={arg}
vararg={ vararg={
'undefined' === type 'undefined' === type
|| (description.vararg && j === description?.args?.length - 1) || description.vararg
} }
/> />
); );