@@ -41,7 +41,7 @@ export default postcss.plugin('postcss-lab-function', opts => {
4141 }
4242 }
4343
44- if ( isSlash ( slashNode ) ) {
44+ if ( slashNode && isSlash ( slashNode ) ) {
4545 slashNode . replaceWith ( newComma ( ) ) ;
4646 }
4747
@@ -129,12 +129,12 @@ const alphaUnitMatch = /^%?$/i;
129129const calcFuncMatch = / ^ c a l c $ / i;
130130const hueUnitMatch = / ^ ( d e g | g r a d | r a d | t u r n ) ? $ / i;
131131
132- const isAlphaValue = node => isCalc ( node ) || Object ( node ) . type === 'number' && alphaUnitMatch . test ( node . unit ) ;
133- const isCalc = node => Object ( node ) . type === 'func' && calcFuncMatch . test ( node . value ) ;
134- const isHue = node => isCalc ( node ) || Object ( node ) . type === 'number' && hueUnitMatch . test ( node . unit ) ;
135- const isNumber = node => isCalc ( node ) || Object ( node ) . type === 'number' && node . unit === '' ;
136- const isPercentage = node => isCalc ( node ) || Object ( node ) . type === 'number' && node . unit === '%' ;
137- const isSlash = node => Object ( node ) . type === 'operator' && node . value === '/' ;
132+ const isAlphaValue = node => isCalc ( node ) || node . type === 'number' && alphaUnitMatch . test ( node . unit ) ;
133+ const isCalc = node => node . type === 'func' && calcFuncMatch . test ( node . value ) ;
134+ const isHue = node => isCalc ( node ) || node . type === 'number' && hueUnitMatch . test ( node . unit ) ;
135+ const isNumber = node => isCalc ( node ) || node . type === 'number' && node . unit === '' ;
136+ const isPercentage = node => isCalc ( node ) || node . type === 'number' && node . unit === '%' ;
137+ const isSlash = node => node . type === 'operator' && node . value === '/' ;
138138const functionalLABMatch = [ isNumber , isNumber , isNumber , isSlash , isAlphaValue ] ;
139139const functionalLCHMatch = [ isNumber , isNumber , isHue , isSlash , isAlphaValue ] ;
140140const functionalGrayMatch = [ isNumber , isSlash , isAlphaValue ] ;
0 commit comments