refactor: triple dot for vararg

This commit is contained in:
cha0s 2021-01-31 02:30:00 -06:00
parent 4a670a58df
commit f6d9b194ed
2 changed files with 10 additions and 5 deletions

View File

@ -72,7 +72,12 @@ const Expression = ({
: {} : {}
), ),
...( ...(
vararg || (isLast && !isFirst) vararg && isFirst
? {'...': {label: '', type: description.type}}
: {}
),
...(
isLast && !isFirst
? {'.': {label: '', type: description.type}} ? {'.': {label: '', type: description.type}}
: {} : {}
), ),
@ -90,11 +95,11 @@ const Expression = ({
}} }}
key={opPath} key={opPath}
onChange={((i) => (event, value, localPath) => { onChange={((i) => (event, value, localPath) => {
if ('.' === value) { if (0 === value.indexOf('.')) {
const parts = localPath.split('/'); const parts = localPath.split('/');
parts.pop(); parts.pop();
parts.pop(); parts.pop();
if (vararg) { if ('...' === value) {
parts.pop(); parts.pop();
patch({ patch({
op: 'remove', op: 'remove',

View File

@ -20,7 +20,7 @@ const Invocation = ({
return ( return (
<Key <Key
childrenDescription={{ childrenDescription={{
'.': {label: '', type: 'undefined'}, '...': {label: '', type: 'undefined'},
'[literal]': {label: '', type: 'undefined'}, '[literal]': {label: '', type: 'undefined'},
...context.describe().children, ...context.describe().children,
'[key]': {label: '', type: 'undefined'}, '[key]': {label: '', type: 'undefined'},
@ -54,7 +54,7 @@ const Invocation = ({
} }
}} }}
path={argPath} path={argPath}
value="." value="..."
/> />
); );
} }