File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,9 @@ _.mixin(_inflections)
8
8
// '1' -> 1
9
9
function toNative ( value ) {
10
10
if ( typeof value === 'string' ) {
11
- if ( value === 'true' || value === 'false' ) {
11
+ if ( value === '' ) {
12
+ return value
13
+ } else if ( value === 'true' || value === 'false' ) {
12
14
return value === 'true'
13
15
} else if ( ! isNaN ( + value ) ) {
14
16
return + value
Original file line number Diff line number Diff line change @@ -32,14 +32,14 @@ describe('utils', function() {
32
32
describe ( 'toNative' , function ( ) {
33
33
34
34
it ( 'should convert string to native type' , function ( ) {
35
-
35
+ // should convert
36
36
assert . strictEqual ( utils . toNative ( '1' ) , 1 )
37
37
assert . strictEqual ( utils . toNative ( 'true' ) , true )
38
-
38
+ // should not convert
39
+ assert . strictEqual ( utils . toNative ( '' ) , '' )
39
40
assert . strictEqual ( utils . toNative ( 'string' ) , 'string' )
40
41
assert . strictEqual ( utils . toNative ( 1 ) , 1 )
41
42
assert . strictEqual ( utils . toNative ( true ) , true )
42
-
43
43
} )
44
44
45
45
} )
You can’t perform that action at this time.
0 commit comments