Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
} while (token.type !== tokTypes.colon);
const valueArray = [];
const valueStart = idx + 1;
let valueEnd;
do {
idx += 1;
token = tokens[idx];
if (
token.type === tokTypes.backQuote
) {
throw new Error('Template strings are not supported');
} else {
valueArray.push(typeof token.value !== 'undefined' ? token.value : token.type.label);
}
valueEnd = idx;
} while (tokens[idx + 1].type !== tokTypes.comma && tokens[idx + 1].type !== tokTypes.braceR);
const value = valueArray.join('');
return {
key: keyArray.join(''),
value,
startIdx,
valueStart,
valueEnd,
endIdx: tokens[idx + 1].type === tokTypes.comma ? idx + 1 : idx,
};
}
function getTrailingToken(context, node, lastItem) {
switch (node.type) {
case "ObjectExpression":
case "ArrayExpression":
case "CallExpression":
case "NewExpression":
return context.getLastToken(node, 1);
default: {
const nextToken = context.getTokenAfter(lastItem);
if (nextToken.type === tokTypes.comma) {
return nextToken;
}
return context.getLastToken(lastItem);
}
}
}
token.type === tokTypes.backQuote
) {
throw new Error('Template strings are not supported');
} else {
valueArray.push(typeof token.value !== 'undefined' ? token.value : token.type.label);
}
valueEnd = idx;
} while (tokens[idx + 1].type !== tokTypes.comma && tokens[idx + 1].type !== tokTypes.braceR);
const value = valueArray.join('');
return {
key: keyArray.join(''),
value,
startIdx,
valueStart,
valueEnd,
endIdx: tokens[idx + 1].type === tokTypes.comma ? idx + 1 : idx,
};
}