forked from MapComplete/MapComplete
Add more documentation and checks to the models
This commit is contained in:
parent
706c5e3d53
commit
47011370dd
4 changed files with 22 additions and 4 deletions
|
@ -104,6 +104,10 @@ export default class LayerConfig {
|
|||
throw context + "Use 'geoJson' instead of 'geoJsonSource'";
|
||||
}
|
||||
|
||||
if (json.source["geojson"] !== undefined) {
|
||||
throw context + "Use 'geoJson' instead of 'geojson' (the J is a capital letter)";
|
||||
}
|
||||
|
||||
this.source = new SourceConfig(
|
||||
{
|
||||
osmTags: osmTags,
|
||||
|
@ -133,6 +137,14 @@ export default class LayerConfig {
|
|||
const key = kv.substring(0, index);
|
||||
const code = kv.substring(index + 1);
|
||||
|
||||
try{
|
||||
|
||||
new Function("feat", "return " + code + ";");
|
||||
}catch(e){
|
||||
throw `Invalid function definition: code ${code} is invalid:${e} (at ${context})`
|
||||
}
|
||||
|
||||
|
||||
this.calculatedTags.push([key, code]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue