@@ -9,7 +9,7 @@ function extract (arr, type, prefix) {
9
9
// * example 1: color+'-'+size+'-'+shape+'-'+wddx_size;
10
10
// * returns 1: 'blue-large-sphere-medium'
11
11
if ( Object . prototype . toString . call ( arr ) === '[object Array]' &&
12
- ( type !== 'EXTR_PREFIX_ALL' && type !== 'EXTR_PREFIX_INVALID' ) ) {
12
+ ( type !== 'EXTR_PREFIX_ALL' && type !== 'EXTR_PREFIX_INVALID' ) ) {
13
13
return 0 ;
14
14
}
15
15
var targetObj = this . window ;
@@ -23,60 +23,60 @@ function extract (arr, type, prefix) {
23
23
var prefixed = prefix + '_' + i ;
24
24
try {
25
25
switch ( type ) {
26
- case 'EXTR_PREFIX_SAME' || 2 :
27
- if ( targetObj [ i ] !== undefined ) {
26
+ case 'EXTR_PREFIX_SAME' || 2 :
27
+ if ( targetObj [ i ] !== undefined ) {
28
+ if ( prefixed . match ( validIdent ) !== null ) {
29
+ targetObj [ prefixed ] = arr [ i ] ;
30
+ ++ chng ;
31
+ }
32
+ } else {
33
+ targetObj [ i ] = arr [ i ] ;
34
+ ++ chng ;
35
+ }
36
+ break ;
37
+ case 'EXTR_SKIP' || 1 :
38
+ if ( targetObj [ i ] === undefined ) {
39
+ targetObj [ i ] = arr [ i ] ;
40
+ ++ chng ;
41
+ }
42
+ break ;
43
+ case 'EXTR_PREFIX_ALL' || 3 :
28
44
if ( prefixed . match ( validIdent ) !== null ) {
29
45
targetObj [ prefixed ] = arr [ i ] ;
30
46
++ chng ;
31
47
}
32
- } else {
33
- targetObj [ i ] = arr [ i ] ;
34
- ++ chng ;
35
- }
36
- break ;
37
- case 'EXTR_SKIP' || 1 :
38
- if ( targetObj [ i ] === undefined ) {
39
- targetObj [ i ] = arr [ i ] ;
40
- ++ chng ;
41
- }
42
- break ;
43
- case 'EXTR_PREFIX_ALL' || 3 :
44
- if ( prefixed . match ( validIdent ) !== null ) {
45
- targetObj [ prefixed ] = arr [ i ] ;
46
- ++ chng ;
47
- }
48
- break ;
49
- case 'EXTR_PREFIX_INVALID' || 4 :
50
- if ( i . match ( validIdent ) !== null ) {
51
- if ( prefixed . match ( validIdent ) !== null ) {
48
+ break ;
49
+ case 'EXTR_PREFIX_INVALID' || 4 :
50
+ if ( i . match ( validIdent ) !== null ) {
51
+ if ( prefixed . match ( validIdent ) !== null ) {
52
+ targetObj [ prefixed ] = arr [ i ] ;
53
+ ++ chng ;
54
+ }
55
+ } else {
56
+ targetObj [ i ] = arr [ i ] ;
57
+ ++ chng ;
58
+ }
59
+ break ;
60
+ case 'EXTR_IF_EXISTS' || 6 :
61
+ if ( targetObj [ i ] !== undefined ) {
62
+ targetObj [ i ] = arr [ i ] ;
63
+ ++ chng ;
64
+ }
65
+ break ;
66
+ case 'EXTR_PREFIX_IF_EXISTS' || 5 :
67
+ if ( targetObj [ i ] !== undefined && prefixed . match ( validIdent ) !== null ) {
52
68
targetObj [ prefixed ] = arr [ i ] ;
53
69
++ chng ;
54
70
}
55
- } else {
56
- targetObj [ i ] = arr [ i ] ;
57
- ++ chng ;
58
- }
59
- break ;
60
- case 'EXTR_IF_EXISTS' || 6 :
61
- if ( targetObj [ i ] !== undefined ) {
71
+ break ;
72
+ case 'EXTR_REFS' || 256 :
73
+ throw 'The EXTR_REFS type will not work in JavaScript' ;
74
+ case 'EXTR_OVERWRITE' || 0 :
75
+ // Fall-through
76
+ default :
62
77
targetObj [ i ] = arr [ i ] ;
63
78
++ chng ;
64
- }
65
- break ;
66
- case 'EXTR_PREFIX_IF_EXISTS' || 5 :
67
- if ( targetObj [ i ] !== undefined && prefixed . match ( validIdent ) !== null ) {
68
- targetObj [ prefixed ] = arr [ i ] ;
69
- ++ chng ;
70
- }
71
- break ;
72
- case 'EXTR_REFS' || 256 :
73
- throw 'The EXTR_REFS type will not work in JavaScript' ;
74
- case 'EXTR_OVERWRITE' || 0 :
75
- // Fall-through
76
- default :
77
- targetObj [ i ] = arr [ i ] ;
78
- ++ chng ;
79
- break ;
79
+ break ;
80
80
}
81
81
} catch ( e ) { // Just won't increment for problem assignments
82
82
}
0 commit comments