@@ -426,49 +426,46 @@ var dashedToCamelCase = function (dashed) {
426
426
} ;
427
427
exports . dashedToCamelCase = dashedToCamelCase ;
428
428
429
- var is_space = / \s / ;
430
- var opening_deliminators = [ '"' , "'" , '(' ] ;
431
- var closing_deliminators = [ '"' , "'" , ')' ] ;
429
+ var isSpace = / \s / ;
430
+ var openingDeliminators = [ '"' , "'" , '(' ] ;
431
+ var closingDeliminators = [ '"' , "'" , ')' ] ;
432
432
// this splits on whitespace, but keeps quoted and parened parts together
433
433
var getParts = function ( str ) {
434
- var deliminator_stack = [ ] ;
434
+ var deliminatorStack = [ ] ;
435
435
var length = str . length ;
436
436
var i ;
437
437
var parts = [ ] ;
438
- var current_part = '' ;
439
- var opening_index ;
440
- var closing_index ;
438
+ var currentPart = '' ;
439
+ var openingIndex ;
440
+ var closingIndex ;
441
441
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 ) ;
448
448
}
449
- current_part = '' ;
449
+ currentPart = '' ;
450
450
} else {
451
- current_part += str [ i ] ;
451
+ currentPart += str [ i ] ;
452
452
}
453
453
} else {
454
454
if ( str [ i ] === '\\' ) {
455
455
i ++ ;
456
- current_part += str [ i ] ;
456
+ currentPart += str [ i ] ;
457
457
} 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 ) ;
466
463
}
467
464
}
468
465
}
469
466
}
470
- if ( current_part !== '' ) {
471
- parts . push ( current_part ) ;
467
+ if ( currentPart !== '' ) {
468
+ parts . push ( currentPart ) ;
472
469
}
473
470
return parts ;
474
471
} ;
@@ -479,11 +476,11 @@ var getParts = function (str) {
479
476
* hand properties and the values are the values to set
480
477
* on them
481
478
*/
482
- exports . shorthandParser = function parse ( v , shorthand_for ) {
479
+ exports . shorthandParser = function parse ( v , shorthandFor ) {
483
480
var obj = { } ;
484
481
var type = exports . valueType ( v ) ;
485
482
if ( type === exports . TYPES . NULL_OR_EMPTY_STR ) {
486
- Object . keys ( shorthand_for ) . forEach ( function ( property ) {
483
+ Object . keys ( shorthandFor ) . forEach ( function ( property ) {
487
484
obj [ property ] = '' ;
488
485
} ) ;
489
486
return obj ;
@@ -503,24 +500,24 @@ exports.shorthandParser = function parse(v, shorthand_for) {
503
500
var parts = getParts ( v ) ;
504
501
var valid = true ;
505
502
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 ;
510
507
obj [ property ] = part ;
511
508
}
512
509
} ) ;
513
- valid = valid && part_valid ;
510
+ valid = valid && partValid ;
514
511
} ) ;
515
512
if ( ! valid ) {
516
513
return undefined ;
517
514
}
518
515
return obj ;
519
516
} ;
520
517
521
- exports . shorthandSetter = function ( property , shorthand_for ) {
518
+ exports . shorthandSetter = function ( property , shorthandFor ) {
522
519
return function ( v ) {
523
- var obj = exports . shorthandParser ( v , shorthand_for ) ;
520
+ var obj = exports . shorthandParser ( v , shorthandFor ) ;
524
521
if ( obj === undefined ) {
525
522
return ;
526
523
}
@@ -538,7 +535,7 @@ exports.shorthandSetter = function (property, shorthand_for) {
538
535
this . _values [ subprop ] = obj [ subprop ] ;
539
536
}
540
537
} , this ) ;
541
- Object . keys ( shorthand_for ) . forEach ( function ( subprop ) {
538
+ Object . keys ( shorthandFor ) . forEach ( function ( subprop ) {
542
539
if ( ! obj . hasOwnProperty ( subprop ) ) {
543
540
this . removeProperty ( subprop ) ;
544
541
delete this . _values [ subprop ] ;
@@ -549,19 +546,19 @@ exports.shorthandSetter = function (property, shorthand_for) {
549
546
// if it already exists, then call the shorthandGetter, if it's an empty
550
547
// string, don't set the property
551
548
this . removeProperty ( property ) ;
552
- var calculated = exports . shorthandGetter ( property , shorthand_for ) . call ( this ) ;
549
+ var calculated = exports . shorthandGetter ( property , shorthandFor ) . call ( this ) ;
553
550
if ( calculated !== '' ) {
554
551
this . _setProperty ( property , calculated ) ;
555
552
}
556
553
} ;
557
554
} ;
558
555
559
- exports . shorthandGetter = function ( property , shorthand_for ) {
556
+ exports . shorthandGetter = function ( property , shorthandFor ) {
560
557
return function ( ) {
561
558
if ( this . _values [ property ] !== undefined ) {
562
559
return this . getPropertyValue ( property ) ;
563
560
}
564
- return Object . keys ( shorthand_for )
561
+ return Object . keys ( shorthandFor )
565
562
. map ( function ( subprop ) {
566
563
return this . getPropertyValue ( subprop ) ;
567
564
} , this )
@@ -577,12 +574,12 @@ exports.shorthandGetter = function (property, shorthand_for) {
577
574
// if two, the first applies to the top and bottom, and the second to left and right
578
575
// if three, the first applies to the top, the second to left and right, the third bottom
579
576
// 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 ;
584
581
}
585
- var part_names = [ 'top' , 'right' , 'bottom' , 'left' ] ;
582
+ var partNames = [ 'top' , 'right' , 'bottom' , 'left' ] ;
586
583
587
584
return function ( v ) {
588
585
if ( typeof v === 'number' ) {
@@ -608,7 +605,7 @@ exports.implicitSetter = function (property_before, property_after, isValid, par
608
605
parts = parts . map ( function ( part ) {
609
606
return parser ( part ) ;
610
607
} ) ;
611
- this . _setProperty ( property_before + property_after , parts . join ( ' ' ) ) ;
608
+ this . _setProperty ( propertyBefore + propertyAfter , parts . join ( ' ' ) ) ;
612
609
if ( parts . length === 1 ) {
613
610
parts [ 1 ] = parts [ 0 ] ;
614
611
}
@@ -620,7 +617,7 @@ exports.implicitSetter = function (property_before, property_after, isValid, par
620
617
}
621
618
622
619
for ( var i = 0 ; i < 4 ; i ++ ) {
623
- var property = property_before + '-' + part_names [ i ] + property_after ;
620
+ var property = propertyBefore + '-' + partNames [ i ] + propertyAfter ;
624
621
this . removeProperty ( property ) ;
625
622
if ( parts [ i ] !== '' ) {
626
623
this . _values [ property ] = parts [ i ] ;
@@ -682,14 +679,14 @@ exports.subImplicitSetter = function (prefix, part, isValid, parser) {
682
679
} ;
683
680
} ;
684
681
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 ) {
689
686
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 ) {
693
690
dashed = '-' + dashed ;
694
691
}
695
692
return dashed ;
0 commit comments