@@ -228,13 +228,13 @@ export function highlight (el) {
228228
229229 var reset = function ( el ) {
230230 var text = el . textContent ,
231- pos = 0 , // current position
231+ pos = 0 , // current position
232232 next1 = text [ 0 ] , // next character
233- chr = 1 , // current character
234- prev1 , // previous character
235- prev2 , // the one before the previous
236- token = // current token content
237- el . innerHTML = "" , // (and cleaning the node)
233+ chr = 1 , // current character
234+ prev1 , // previous character
235+ prev2 , // the one before the previous
236+ token = // current token content
237+ el . innerHTML = "" , // (and cleaning the node)
238238
239239 // current token type:
240240 // 0: anything else (whitespaces / newlines)
@@ -274,11 +274,11 @@ export function highlight (el) {
274274 ( tokenType > 8 && chr == "\n" ) ||
275275 [ // finalize conditions for other token types
276276 // 0: whitespaces
277- / \S / [ test ] ( chr ) , // merged together
277+ / \S / [ test ] ( chr ) , // merged together
278278 // 1: operators
279- 1 , // consist of a single character
279+ 1 , // consist of a single character
280280 // 2: braces
281- 1 , // consist of a single character
281+ 1 , // consist of a single character
282282 // 3: (key)word
283283 ! / [ $ \w ] / [ test ] ( chr ) ,
284284 // 4: regex
@@ -341,12 +341,12 @@ export function highlight (el) {
341341 // condition)
342342 tokenType = 11
343343 while ( ! [
344- 1 , // 0: whitespace
344+ 1 , // 0: whitespace
345345 // 1: operator or braces
346- / [ \/ { } [ ( \- + * = < > : ; | \\ . , ? ! & @ ~ ] / [ test ] ( chr ) , // eslint-disable-line no-useless-escape
347- / [ \] ) ] / [ test ] ( chr ) , // 2: closing brace
348- / [ $ \w ] / [ test ] ( chr ) , // 3: (key)word
349- chr == "/" && // 4: regex
346+ / [ \/ { } [ ( \- + * = < > : ; | \\ . , ? ! & @ ~ ] / [ test ] ( chr ) , // eslint-disable-line no-useless-escape
347+ / [ \] ) ] / [ test ] ( chr ) , // 2: closing brace
348+ / [ $ \w ] / [ test ] ( chr ) , // 3: (key)word
349+ chr == "/" && // 4: regex
350350 // previous token was an
351351 // opening brace or an
352352 // operator (otherwise
@@ -355,13 +355,13 @@ export function highlight (el) {
355355 // workaround for xml
356356 // closing tags
357357 prev1 != "<" ,
358- chr == "\"" , // 5: string with "
359- chr == "'" , // 6: string with '
358+ chr == "\"" , // 5: string with "
359+ chr == "'" , // 6: string with '
360360 // 7: xml comment
361361 chr + next1 + text [ pos + 1 ] + text [ pos + 2 ] == "<!--" ,
362- chr + next1 == "/*" , // 8: multiline comment
363- chr + next1 == "//" , // 9: single-line comment
364- chr == "#" // 10: hash-style comment
362+ chr + next1 == "/*" , // 8: multiline comment
363+ chr + next1 == "//" , // 9: single-line comment
364+ chr == "#" // 10: hash-style comment
365365 ] [ -- tokenType ] ) ;
366366 }
367367
@@ -451,13 +451,13 @@ export const propChecker = (props, nextProps, objectList=[], ignoreList=[]) => {
451451}
452452
453453export const validateNumber = ( val ) => {
454- if ( ! / ^ - ? \d + ( \. ? \d + ) ? $ / . test ( val ) ) {
454+ if ( ! / ^ - ? \d + ( \. ? \d + ) ? $ / . test ( val ) ) {
455455 return "Value must be a number"
456456 }
457457}
458458
459459export const validateInteger = ( val ) => {
460- if ( ! / ^ - ? \d + $ / . test ( val ) ) {
460+ if ( ! / ^ - ? \d + $ / . test ( val ) ) {
461461 return "Value must be an integer"
462462 }
463463}
@@ -485,6 +485,10 @@ export const validateParam = (param, isXml) => {
485485 return errors
486486 }
487487
488+ if ( value === null || value === undefined ) {
489+ return errors
490+ }
491+
488492 if ( type === "number" ) {
489493 let err = validateNumber ( value )
490494 if ( ! err ) return errors
0 commit comments