Skip to content

Commit

Permalink
fix: handle token parameters undefined (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
ComLock authored and gajus committed Sep 1, 2018
1 parent 28522d4 commit 631b161
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/createGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const renderSelector = (selectorToken: SelectorTokenType) => {
} else if (token.type === 'pseudoClassSelector') {
part = ':' + token.name;

if (token.parameters.length) {
if (token.parameters && token.parameters.length) {
part += '(' + token.parameters.map(escapeValue).join(', ') + ')';
}
} else if (token.type === 'pseudoElementSelector') {
Expand Down
1 change: 1 addition & 0 deletions test/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const MIRROR = {};
/* eslint-disable sort-keys */
const validSelectors = {
'*': MIRROR,
'.className:focus': MIRROR,
'::grault': MIRROR,
'foo > bar > baz': MIRROR,
'foo ~ bar ~ baz': MIRROR,
Expand Down

0 comments on commit 631b161

Please sign in to comment.