Properly handle arrays as candidates for json key.

This commit is contained in:
Young Hahn
2013-07-12 13:22:33 -04:00
parent 0c2ff3ed4e
commit fe2caf155f

View File

@@ -556,7 +556,10 @@ MBTiles.prototype.putInfo = function(data, callback) {
// If a data property is a javascript hash/object, slip it into
// the 'json' field which contains stringified JSON to be merged
// in at read time. Allows nested/deep metadata to be recorded.
if (typeof data[key] === 'object' && !Array.isArray(data[key])) {
var nested = typeof data[key] === 'object' &&
key !== 'bounds' &&
key !== 'center';
if (nested) {
jsondata = jsondata || {};
jsondata[key] = data[key];
} else {