@@ -47,11 +47,10 @@ function resolveYamlInteger(data) {
47
47
48
48
for ( ; index < max ; index ++ ) {
49
49
ch = data [ index ] ;
50
- if ( ch === '_' ) continue ;
51
50
if ( ch !== '0' && ch !== '1' ) return false ;
52
51
hasDigits = true ;
53
52
}
54
- return hasDigits && ch !== '_' ;
53
+ return hasDigits ;
55
54
}
56
55
57
56
@@ -61,55 +60,42 @@ function resolveYamlInteger(data) {
61
60
62
61
for ( ; index < max ; index ++ ) {
63
62
ch = data [ index ] ;
64
- if ( ch === '_' ) continue ;
65
63
if ( ! isHexCode ( data . charCodeAt ( index ) ) ) return false ;
66
64
hasDigits = true ;
67
65
}
68
- return hasDigits && ch !== '_' ;
66
+ return hasDigits ;
69
67
}
70
68
71
-
72
69
if ( ch === 'o' ) {
73
70
// base 8
74
71
index ++ ;
75
72
76
73
for ( ; index < max ; index ++ ) {
77
74
ch = data [ index ] ;
78
- if ( ch === '_' ) continue ;
79
75
if ( ! isOctCode ( data . charCodeAt ( index ) ) ) return false ;
80
76
hasDigits = true ;
81
77
}
82
- return hasDigits && ch !== '_' ;
78
+ return hasDigits ;
83
79
}
84
80
}
85
81
86
82
// base 10 (except 0)
87
83
88
- // value should not start with `_`;
89
- if ( ch === '_' ) return false ;
90
-
91
84
for ( ; index < max ; index ++ ) {
92
85
ch = data [ index ] ;
93
- if ( ch === '_' ) continue ;
94
86
if ( ! isDecCode ( data . charCodeAt ( index ) ) ) {
95
87
return false ;
96
88
}
97
89
hasDigits = true ;
98
90
}
99
91
100
- // Should have digits and should not end with `_`
101
- if ( ! hasDigits || ch === '_' ) return false ;
102
-
103
- return true ;
92
+ // Should have digits
93
+ return hasDigits ;
104
94
}
105
95
106
96
function constructYamlInteger ( data ) {
107
97
var value = data , sign = 1 , ch ;
108
98
109
- if ( value . indexOf ( '_' ) !== - 1 ) {
110
- value = value . replace ( / _ / g, '' ) ;
111
- }
112
-
113
99
ch = value [ 0 ] ;
114
100
115
101
if ( ch === '-' || ch === '+' ) {
0 commit comments