up convert to name

This commit is contained in:
Tykayn 2024-10-09 16:34:52 +02:00 committed by tykayn
parent e414600d45
commit c28741d751
4 changed files with 21292 additions and 16 deletions

View File

@ -15,7 +15,7 @@ const mappingFINESS: MappingConfigType = {
},
filters: {
// exclude_point_if_tag_not_empty: ['id_osm'],
offset: 1
// offset: 1
},
add_not_mapped_tags_too: false,
boolean_keys: [],

View File

@ -455,6 +455,9 @@ export default class {
*/
if (configObject.conditional_values) {
// convert numbers from json to string to compare them correctly
originalValue = ''+originalValue
let keysConditionnalValues: any = Object.keys(configObject.conditional_values)
let isFoundValue = keysConditionnalValues.indexOf(originalValue)
let conditionnalConfig: any = configObject.conditional_values[keysConditionnalValues[isFoundValue]]
@ -464,10 +467,13 @@ export default class {
debugLog('isFoundValue', isFoundValue, originalValue)
debugLog('keysConditionnalValues', keysConditionnalValues)
debugLog('-----++++++++ originalValue', originalValue)
debugLog('----------- isFoundValue', isFoundValue)
if (!remove_original_key) {
if (isFoundValue > -1) {
if (isFoundValue !== -1) {
debugLog('found condition',isFoundValue )
/** ----------------------
* gestion des valeurs conditionnelles
@ -508,16 +514,10 @@ export default class {
// on peut définir un ensemble de tags à rajouter
let tagKeys = Object.keys(conditionnalConfig.tags_to_add)
debugLog('conditionnalConfig.tags_to_add', conditionnalConfig.tags_to_add)
conditionnalConfig.tags_to_add.forEach((object: any, pair: any) => {
debugLog('object', object)
debugLog('pair', pair)
let key: any = Object.keys(object)
key = key[0]
let value = object[key]
debugLog('key', key)
debugLog('value', value)
newProperties[key] = value
tagKeys.forEach((index:any) => {
debugLog('key', index)
debugLog('value', conditionnalConfig.tags_to_add[index])
newProperties[index] = conditionnalConfig.tags_to_add[index]
})
}

View File

@ -72,8 +72,12 @@ export default class Formatters {
static convertToName(originalValue: string) {
let tab = originalValue.toLowerCase().split('')
tab[0] = originalValue[0].toUpperCase()
return tab.join('');
if (originalValue && originalValue.length) {
let tab = originalValue.toLowerCase().split('')
tab[0] = originalValue[0].toUpperCase()
return tab.join('');
}
return ''
}
}

File diff suppressed because it is too large Load Diff