@@ -426,49 +426,46 @@ var dashedToCamelCase = function (dashed) {
426426} ;
427427exports . dashedToCamelCase = dashedToCamelCase ;
428428
429- var is_space = / \s / ;
430- var opening_deliminators = [ '"' , "'" , '(' ] ;
431- var closing_deliminators = [ '"' , "'" , ')' ] ;
429+ var isSpace = / \s / ;
430+ var openingDeliminators = [ '"' , "'" , '(' ] ;
431+ var closingDeliminators = [ '"' , "'" , ')' ] ;
432432// this splits on whitespace, but keeps quoted and parened parts together
433433var getParts = function ( str ) {
434- var deliminator_stack = [ ] ;
434+ var deliminatorStack = [ ] ;
435435 var length = str . length ;
436436 var i ;
437437 var parts = [ ] ;
438- var current_part = '' ;
439- var opening_index ;
440- var closing_index ;
438+ var currentPart = '' ;
439+ var openingIndex ;
440+ var closingIndex ;
441441 for ( i = 0 ; i < length ; i ++ ) {
442- opening_index = opening_deliminators . indexOf ( str [ i ] ) ;
443- closing_index = closing_deliminators . indexOf ( str [ i ] ) ;
444- if ( is_space . test ( str [ i ] ) ) {
445- if ( deliminator_stack . length === 0 ) {
446- if ( current_part !== '' ) {
447- parts . push ( current_part ) ;
442+ openingIndex = openingDeliminators . indexOf ( str [ i ] ) ;
443+ closingIndex = closingDeliminators . indexOf ( str [ i ] ) ;
444+ if ( isSpace . test ( str [ i ] ) ) {
445+ if ( deliminatorStack . length === 0 ) {
446+ if ( currentPart !== '' ) {
447+ parts . push ( currentPart ) ;
448448 }
449- current_part = '' ;
449+ currentPart = '' ;
450450 } else {
451- current_part += str [ i ] ;
451+ currentPart += str [ i ] ;
452452 }
453453 } else {
454454 if ( str [ i ] === '\\' ) {
455455 i ++ ;
456- current_part += str [ i ] ;
456+ currentPart += str [ i ] ;
457457 } else {
458- current_part += str [ i ] ;
459- if (
460- closing_index !== - 1 &&
461- closing_index === deliminator_stack [ deliminator_stack . length - 1 ]
462- ) {
463- deliminator_stack . pop ( ) ;
464- } else if ( opening_index !== - 1 ) {
465- deliminator_stack . push ( opening_index ) ;
458+ currentPart += str [ i ] ;
459+ if ( closingIndex !== - 1 && closingIndex === deliminatorStack [ deliminatorStack . length - 1 ] ) {
460+ deliminatorStack . pop ( ) ;
461+ } else if ( openingIndex !== - 1 ) {
462+ deliminatorStack . push ( openingIndex ) ;
466463 }
467464 }
468465 }
469466 }
470- if ( current_part !== '' ) {
471- parts . push ( current_part ) ;
467+ if ( currentPart !== '' ) {
468+ parts . push ( currentPart ) ;
472469 }
473470 return parts ;
474471} ;
@@ -479,11 +476,11 @@ var getParts = function (str) {
479476 * hand properties and the values are the values to set
480477 * on them
481478 */
482- exports . shorthandParser = function parse ( v , shorthand_for ) {
479+ exports . shorthandParser = function parse ( v , shorthandFor ) {
483480 var obj = { } ;
484481 var type = exports . valueType ( v ) ;
485482 if ( type === exports . TYPES . NULL_OR_EMPTY_STR ) {
486- Object . keys ( shorthand_for ) . forEach ( function ( property ) {
483+ Object . keys ( shorthandFor ) . forEach ( function ( property ) {
487484 obj [ property ] = '' ;
488485 } ) ;
489486 return obj ;
@@ -503,24 +500,24 @@ exports.shorthandParser = function parse(v, shorthand_for) {
503500 var parts = getParts ( v ) ;
504501 var valid = true ;
505502 parts . forEach ( function ( part , i ) {
506- var part_valid = false ;
507- Object . keys ( shorthand_for ) . forEach ( function ( property ) {
508- if ( shorthand_for [ property ] . isValid ( part , i ) ) {
509- part_valid = true ;
503+ var partValid = false ;
504+ Object . keys ( shorthandFor ) . forEach ( function ( property ) {
505+ if ( shorthandFor [ property ] . isValid ( part , i ) ) {
506+ partValid = true ;
510507 obj [ property ] = part ;
511508 }
512509 } ) ;
513- valid = valid && part_valid ;
510+ valid = valid && partValid ;
514511 } ) ;
515512 if ( ! valid ) {
516513 return undefined ;
517514 }
518515 return obj ;
519516} ;
520517
521- exports . shorthandSetter = function ( property , shorthand_for ) {
518+ exports . shorthandSetter = function ( property , shorthandFor ) {
522519 return function ( v ) {
523- var obj = exports . shorthandParser ( v , shorthand_for ) ;
520+ var obj = exports . shorthandParser ( v , shorthandFor ) ;
524521 if ( obj === undefined ) {
525522 return ;
526523 }
@@ -538,7 +535,7 @@ exports.shorthandSetter = function (property, shorthand_for) {
538535 this . _values [ subprop ] = obj [ subprop ] ;
539536 }
540537 } , this ) ;
541- Object . keys ( shorthand_for ) . forEach ( function ( subprop ) {
538+ Object . keys ( shorthandFor ) . forEach ( function ( subprop ) {
542539 if ( ! obj . hasOwnProperty ( subprop ) ) {
543540 this . removeProperty ( subprop ) ;
544541 delete this . _values [ subprop ] ;
@@ -549,19 +546,19 @@ exports.shorthandSetter = function (property, shorthand_for) {
549546 // if it already exists, then call the shorthandGetter, if it's an empty
550547 // string, don't set the property
551548 this . removeProperty ( property ) ;
552- var calculated = exports . shorthandGetter ( property , shorthand_for ) . call ( this ) ;
549+ var calculated = exports . shorthandGetter ( property , shorthandFor ) . call ( this ) ;
553550 if ( calculated !== '' ) {
554551 this . _setProperty ( property , calculated ) ;
555552 }
556553 } ;
557554} ;
558555
559- exports . shorthandGetter = function ( property , shorthand_for ) {
556+ exports . shorthandGetter = function ( property , shorthandFor ) {
560557 return function ( ) {
561558 if ( this . _values [ property ] !== undefined ) {
562559 return this . getPropertyValue ( property ) ;
563560 }
564- return Object . keys ( shorthand_for )
561+ return Object . keys ( shorthandFor )
565562 . map ( function ( subprop ) {
566563 return this . getPropertyValue ( subprop ) ;
567564 } , this )
@@ -577,12 +574,12 @@ exports.shorthandGetter = function (property, shorthand_for) {
577574// if two, the first applies to the top and bottom, and the second to left and right
578575// if three, the first applies to the top, the second to left and right, the third bottom
579576// if four, top, right, bottom, left
580- exports . implicitSetter = function ( property_before , property_after , isValid , parser ) {
581- property_after = property_after || '' ;
582- if ( property_after !== '' ) {
583- property_after = '-' + property_after ;
577+ exports . implicitSetter = function ( propertyBefore , propertyAfter , isValid , parser ) {
578+ propertyAfter = propertyAfter || '' ;
579+ if ( propertyAfter !== '' ) {
580+ propertyAfter = '-' + propertyAfter ;
584581 }
585- var part_names = [ 'top' , 'right' , 'bottom' , 'left' ] ;
582+ var partNames = [ 'top' , 'right' , 'bottom' , 'left' ] ;
586583
587584 return function ( v ) {
588585 if ( typeof v === 'number' ) {
@@ -608,7 +605,7 @@ exports.implicitSetter = function (property_before, property_after, isValid, par
608605 parts = parts . map ( function ( part ) {
609606 return parser ( part ) ;
610607 } ) ;
611- this . _setProperty ( property_before + property_after , parts . join ( ' ' ) ) ;
608+ this . _setProperty ( propertyBefore + propertyAfter , parts . join ( ' ' ) ) ;
612609 if ( parts . length === 1 ) {
613610 parts [ 1 ] = parts [ 0 ] ;
614611 }
@@ -620,7 +617,7 @@ exports.implicitSetter = function (property_before, property_after, isValid, par
620617 }
621618
622619 for ( var i = 0 ; i < 4 ; i ++ ) {
623- var property = property_before + '-' + part_names [ i ] + property_after ;
620+ var property = propertyBefore + '-' + partNames [ i ] + propertyAfter ;
624621 this . removeProperty ( property ) ;
625622 if ( parts [ i ] !== '' ) {
626623 this . _values [ property ] = parts [ i ] ;
@@ -682,14 +679,14 @@ exports.subImplicitSetter = function (prefix, part, isValid, parser) {
682679 } ;
683680} ;
684681
685- var camel_to_dashed = / [ A - Z ] / g;
686- var first_segment = / ^ \( [ ^ - ] \) - / ;
687- var vendor_prefixes = [ 'o' , 'moz' , 'ms' , 'webkit' ] ;
688- exports . camelToDashed = function ( camel_case ) {
682+ var camelToDashed = / [ A - Z ] / g;
683+ var firstSegment = / ^ \( [ ^ - ] \) - / ;
684+ var vendorPrefixes = [ 'o' , 'moz' , 'ms' , 'webkit' ] ;
685+ exports . camelToDashed = function ( camelCase ) {
689686 var match ;
690- var dashed = camel_case . replace ( camel_to_dashed , '-$&' ) . toLowerCase ( ) ;
691- match = dashed . match ( first_segment ) ;
692- if ( match && vendor_prefixes . indexOf ( match [ 1 ] ) !== - 1 ) {
687+ var dashed = camelCase . replace ( camelToDashed , '-$&' ) . toLowerCase ( ) ;
688+ match = dashed . match ( firstSegment ) ;
689+ if ( match && vendorPrefixes . indexOf ( match [ 1 ] ) !== - 1 ) {
693690 dashed = '-' + dashed ;
694691 }
695692 return dashed ;
0 commit comments