File tree 2 files changed +16
-2
lines changed
2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ var truncate = function truncate(value) {
69
69
}
70
70
} else if ( type ( value ) === 'object' ) {
71
71
for ( var key in value ) {
72
- if ( value . hasOwnProperty ( key ) ) {
72
+ if ( key in value ) {
73
73
value [ key ] = truncate ( value [ key ] ) ;
74
74
}
75
75
}
@@ -110,7 +110,7 @@ var validateProperties = function validateProperties(properties) {
110
110
111
111
var copy = { } ; // create a copy with all of the valid properties
112
112
for ( var property in properties ) {
113
- if ( ! properties . hasOwnProperty ( property ) ) {
113
+ if ( ! ( property in properties ) ) {
114
114
continue ;
115
115
}
116
116
Original file line number Diff line number Diff line change @@ -239,5 +239,19 @@ describe('utils', function() {
239
239
}
240
240
assert . deepEqual ( utils . validateProperties ( properties ) , { } ) ;
241
241
} ) ;
242
+
243
+ it ( 'should validate properties on null objects' , function ( ) {
244
+ var properties = Object . create ( null ) ;
245
+ properties [ 'test' ] = 'yes' ;
246
+ properties [ 'key' ] = 'value' ;
247
+ properties [ '15' ] = '16' ;
248
+
249
+ var expected = {
250
+ 'test' : 'yes' ,
251
+ 'key' : 'value' ,
252
+ '15' : '16'
253
+ } ;
254
+ assert . deepEqual ( utils . validateProperties ( properties ) , expected ) ;
255
+ } ) ;
242
256
} ) ;
243
257
} ) ;
You can’t perform that action at this time.
0 commit comments