Skip to content

Commit

Permalink
Fix missing key for each token
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Quadflieg committed Nov 23, 2019
1 parent 4ac7812 commit aff4969
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,11 @@ export const plugin: Plugin = {
}
case 'each':
result = printIndent(previousToken, result, indent, indentLevel);
result += `each ${token.val} in ${token.code}`;
result += `each ${token.val}`;
if (token.key !== null) {
result += `, ${token.key}`;
}
result += ` in ${token.code}`;
break;
case 'while':
result = printIndent(previousToken, result, indent, indentLevel);
Expand Down
2 changes: 1 addition & 1 deletion src/pug-lexer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ declare module 'pug-lexer' {

export interface EachToken extends LexToken<'each'> {
val: string;
key: null;
key: string | null;
code: string;
}

Expand Down

0 comments on commit aff4969

Please sign in to comment.