Remove dictionary as placeholder type for named maps
This commit is contained in:
@@ -436,9 +436,11 @@ function _replaceVars (str, params) {
|
||||
});
|
||||
return str;
|
||||
}
|
||||
function isDictionary(val) {
|
||||
|
||||
function isObject(val) {
|
||||
return ( _.isObject(val) && !_.isArray(val) && !_.isFunction(val));
|
||||
}
|
||||
|
||||
TemplateMaps.prototype.instance = function(template, params) {
|
||||
var all_params = {};
|
||||
var phold = template.placeholders || {};
|
||||
@@ -467,11 +469,6 @@ TemplateMaps.prototype.instance = function(template, params) {
|
||||
throw new Error("Invalid css_color value for template parameter '" + k + "': " + val);
|
||||
}
|
||||
}
|
||||
else if ( type === 'dictionary' ) {
|
||||
if (!isDictionary(val)) {
|
||||
throw new Error("Invalid dictionary value for template parameter '" + k + "': " + val);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// NOTE: should be checked at template create/update time
|
||||
throw new Error("Invalid placeholder type '" + type + "'");
|
||||
@@ -484,7 +481,7 @@ TemplateMaps.prototype.instance = function(template, params) {
|
||||
|
||||
if (typeof layergroup.buffersize === 'string') {
|
||||
layergroup.buffersize = Number(_replaceVars(layergroup.buffersize, all_params));
|
||||
} else if (isDictionary(layergroup.buffersize)) {
|
||||
} else if (isObject(layergroup.buffersize)) {
|
||||
Object.keys(layergroup.buffersize).forEach(function(k) {
|
||||
layergroup.buffersize[k] = Number(_replaceVars(layergroup.buffersize[k], all_params));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user