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