File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 79
79
} ;
80
80
81
81
function getShallowProperty ( obj , prop ) {
82
- if ( options . includeInheritedProps || ( typeof prop === 'number' && Array . isArray ( obj ) ) || obj . hasOwnProperty ( prop ) ) {
82
+ if ( options . includeInheritedProps || ( typeof prop === 'number' && Array . isArray ( obj ) ) || _hasOwnProperty . call ( obj , prop ) ) {
83
83
return obj [ prop ] ;
84
84
}
85
85
}
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " object-path" ,
3
3
"description" : " Access deep object properties using a path" ,
4
- "version" : " 0.11.0 " ,
4
+ "version" : " 0.11.1 " ,
5
5
"author" : {
6
6
"name" : " Mario Casciaro"
7
7
},
Original file line number Diff line number Diff line change @@ -102,6 +102,16 @@ describe('get', function() {
102
102
expect ( objectPath . get ( undefined , 'test' , 'a' ) ) . to . be . deep . equal ( 'a' ) ;
103
103
} ) ;
104
104
105
+ it (
106
+ 'should not fail on an object with a null prototype' ,
107
+ function assertSuccessForObjWithNullProto ( ) {
108
+ var foo = 'FOO' ;
109
+ var objWithNullProto = Object . create ( null ) ;
110
+ objWithNullProto . foo = foo ;
111
+ expect ( objectPath . get ( objWithNullProto , 'foo' ) ) . to . equal ( foo ) ;
112
+ }
113
+ ) ;
114
+
105
115
it ( 'should skip non own properties' , function ( ) {
106
116
var Base = function ( enabled ) { } ;
107
117
Base . prototype = {
@@ -772,7 +782,7 @@ describe('bind object', function () {
772
782
} ) ;
773
783
} ) ;
774
784
775
- describe ( 'Don\' access not own properties [default]' , function ( ) {
785
+ describe ( 'Don\'t access not own properties [default]' , function ( ) {
776
786
it ( 'should not get a not own property' , function ( ) {
777
787
var Obj = function ( ) { } ;
778
788
Obj . prototype . notOwn = { a : 'a' } ;
You can’t perform that action at this time.
0 commit comments