Skip to content

Commit

Permalink
Don't convert null to the string "null" (#39)
Browse files Browse the repository at this point in the history
I hope this is an acceptable change, although I don't know the complete requirements of this package, but this fix will solve mapbox/mapbox-gl-js#8497.

I also have a hard time thinking of a reason it would make sense to have null as a string `"null"` because of the ambiguity it brings.

Co-authored-by: Vladimir Agafonkin <agafonkin@gmail.com>
  • Loading branch information
porsager and mourner authored May 19, 2021
1 parent bb051a8 commit e07afa4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function writeProperties (context, pbf) {

var value = feature.properties[key]
var type = typeof value
if (type !== 'string' && type !== 'boolean' && type !== 'number') {
if (value !== null && type !== 'string' && type !== 'boolean' && type !== 'number') {
value = JSON.stringify(value)
}
var valueKey = type + ':' + value
Expand Down

0 comments on commit e07afa4

Please sign in to comment.