File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -94,17 +94,20 @@ function writeProperties (context, pbf) {
9494 var valuecache = context . valuecache
9595
9696 for ( var key in feature . properties ) {
97+ var value = feature . properties [ key ]
98+
9799 var keyIndex = keycache [ key ]
100+ if ( value === null ) continue // don't encode null value properties
101+
98102 if ( typeof keyIndex === 'undefined' ) {
99103 keys . push ( key )
100104 keyIndex = keys . length - 1
101105 keycache [ key ] = keyIndex
102106 }
103107 pbf . writeVarint ( keyIndex )
104108
105- var value = feature . properties [ key ]
106109 var type = typeof value
107- if ( value !== null && type !== 'string' && type !== 'boolean' && type !== 'number' ) {
110+ if ( type !== 'string' && type !== 'boolean' && type !== 'number' ) {
108111 value = JSON . stringify ( value )
109112 }
110113 var valueKey = type + ':' + value
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ test('property encoding', function (t) {
5555 var second = layer . feature ( 1 ) . properties
5656 t . same ( first . c , '{"hello":"world"}' )
5757 t . same ( first . d , '[1,2,3]' )
58- t . equals ( first . e , null )
58+ t . equals ( first . e , undefined )
5959 t . same ( second . c , '{"goodbye":"planet"}' )
6060 t . same ( second . d , '{"hello":"world"}' )
6161 t . end ( )
You can’t perform that action at this time.
0 commit comments