File tree 2 files changed +8
-1
lines changed
packages/react-bootstrap-table2
2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,11 @@ function splitNested(str) {
12
12
}
13
13
14
14
function get ( target , field ) {
15
+ const directGet = target [ field ] ;
16
+ if ( directGet !== undefined && directGet !== null ) {
17
+ return directGet ;
18
+ }
19
+
15
20
const pathArray = splitNested ( field ) ;
16
21
let result ;
17
22
try {
Original file line number Diff line number Diff line change @@ -10,7 +10,8 @@ describe('Utils', () => {
10
10
city : {
11
11
name : 'B'
12
12
}
13
- }
13
+ } ,
14
+ 'person.name' : 'John Doe'
14
15
} ;
15
16
16
17
it ( 'should return correct data' , ( ) => {
@@ -19,6 +20,7 @@ describe('Utils', () => {
19
20
expect ( _ . get ( data , 'address.city.name' ) ) . toEqual ( data . address . city . name ) ;
20
21
expect ( _ . get ( data , 'address.notExist' ) ) . toEqual ( undefined ) ;
21
22
expect ( _ . get ( data , 'address.not.exist' ) ) . toEqual ( undefined ) ;
23
+ expect ( _ . get ( data , 'person.name' ) ) . toEqual ( data [ 'person.name' ] ) ;
22
24
} ) ;
23
25
} ) ;
24
26
You can’t perform that action at this time.
0 commit comments