fix weird phones number

This commit is contained in:
Tykayn 2023-08-30 15:09:41 +02:00 committed by tykayn
parent 441c753cb9
commit ee10a3a7aa
10 changed files with 76618 additions and 334 deletions

View File

@ -1 +0,0 @@
,cipherbliss,nova,30.08.2023 11:37,file:///home/cipherbliss/.config/libreoffice/4;

View File

@ -0,0 +1 @@
,cipherbliss,nova,30.08.2023 12:48,file:///home/cipherbliss/.config/libreoffice/4;

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
"version": 0.6, "version": 0.6,
"generator": "Overpass API 0.7.61.5 4133829e", "generator": "Overpass API 0.7.61.5 4133829e",
"osm3s": { "osm3s": {
"timestamp_osm_base": "2023-08-30T09:36:01Z", "timestamp_osm_base": "2023-08-30T09:42:03Z",
"timestamp_areas_base": "2023-08-30T07:21:46Z", "timestamp_areas_base": "2023-08-30T07:21:46Z",
"copyright": "The data included in this document is from www.openstreetmap.org. The data is made available under ODbL." "copyright": "The data included in this document is from www.openstreetmap.org. The data is made available under ODbL."
}, },

29229
data_other/phones_essonne.csv Normal file

File diff suppressed because it is too large Load Diff

27912
data_other/phones_essonne.json Normal file

File diff suppressed because it is too large Load Diff

View File

@ -23,7 +23,7 @@ export default class {
} }
setConfig(mappingConfig: MappingConfigType) { setConfig(mappingConfig: MappingConfigType) {
console.log('load config', mappingConfig.config_name) debugLog('load config', mappingConfig.config_name)
this.mapping_config = mappingConfig this.mapping_config = mappingConfig
} }
@ -247,9 +247,59 @@ export default class {
debugLog('convertProperty: is NOT having boolean_value_conversion', mappingValueObject) debugLog('convertProperty: is NOT having boolean_value_conversion', mappingValueObject)
} }
if (configObject.convert_to_phone) { if (configObject.convert_to_phone) {
console.log('originalValue', originalValue.substring(1)) debugLog('originalValue', originalValue.substring(1))
let temp = `${'' + originalValue.substring(1)}` let original_without_spaces = originalValue.replace(' ','')
convertedValue = `+33${temp}`; let cleaned_value = `${original_without_spaces}`
cleaned_value = cleaned_value
.trim()
.replace('Stations-e', '')
.replace('(numéro unique)', '')
.replace(/[\(\)\.\- ]/g, '')
let original_array = originalValue.split('')
let add_prefix = false;
if (
/^\d/.test(cleaned_value) &&
! /^\+33 /.test(originalValue)
){
add_prefix = true
}
cleaned_value = cleaned_value.replace('+33', '')
if (/^0/.test(cleaned_value) ){
cleaned_value= cleaned_value.substring(1)
}
let array_of_numbers = cleaned_value
.split('')
let ii = 0;
if(cleaned_value.length == 4){
ii=1
}
convertedValue = ''
array_of_numbers.forEach((num: string) => {
if (ii % 2) {
convertedValue += ' ';
}
convertedValue += num;
ii++;
})
convertedValue = convertedValue.replace(' ', ' ').trim();
console.log('convertedValue', convertedValue)
if (
/^\d/.test(convertedValue) &&
! /^\+33 /.test(convertedValue)
){
add_prefix = true
}
if (add_prefix) {
convertedValue = `+33 ` + convertedValue
}
} }
if (configObject.remove_original_key) { if (configObject.remove_original_key) {
remove_original_key = true remove_original_key = true

310
package-lock.json generated
View File

@ -9,22 +9,25 @@
"version": "1.0.0", "version": "1.0.0",
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"dependencies": { "dependencies": {
"csv": "^6.3.1",
"geojsontoosm": "^0.0.3",
"minimist": "^1.2.8", "minimist": "^1.2.8",
"node-fs": "^0.1.7" "node-fs": "^0.1.7"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.22.5", "@babel/core": "^7.22.9",
"@babel/preset-env": "^7.22.5", "@babel/preset-env": "^7.22.9",
"@babel/preset-typescript": "^7.22.5", "@babel/preset-typescript": "^7.22.5",
"@jest/globals": "^29.5.0", "@jest/globals": "^29.6.2",
"@types/minimist": "^1.2.2", "@types/minimist": "^1.2.2",
"@types/node": "^20.4.5", "@types/node": "^20.4.7",
"babel-jest": "^29.5.0", "babel-jest": "^29.6.2",
"jest": "^29.5.0", "jest": "^29.6.2",
"loglevel": "^1.8.1", "loglevel": "^1.8.1",
"nodemon": "^2.0.22", "nodemon": "^2.0.22",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"tslib": "^2.6.0", "tslib": "^2.6.1",
"typescript": "^5.1.6" "typescript": "^5.1.6"
} }
}, },
@ -2648,9 +2651,9 @@
"dev": true "dev": true
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "20.4.5", "version": "20.5.7",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.5.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.5.7.tgz",
"integrity": "sha512-rt40Nk13II9JwQBdeYqmbn2Q6IVTA5uPhvSO+JVqdXw/6/4glI6oR9ezty/A9Hg5u7JH4OmYmuQ+XvjKm0Datg==", "integrity": "sha512-dP7f3LdZIysZnmvP3ANJYTSwg+wLLl8p7RqniVlV7j+oXSXAbt9h0WIBFmJy5inWZoX9wZN6eXx+YXd9Rh3RBA==",
"dev": true "dev": true
}, },
"node_modules/@types/stack-utils": { "node_modules/@types/stack-utils": {
@ -3034,6 +3037,18 @@
"node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
} }
}, },
"node_modules/bs-logger": {
"version": "0.2.6",
"resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz",
"integrity": "sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==",
"dev": true,
"dependencies": {
"fast-json-stable-stringify": "2.x"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/bser": { "node_modules/bser": {
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz",
@ -3046,8 +3061,7 @@
"node_modules/buffer-from": { "node_modules/buffer-from": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
"integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ=="
"dev": true
}, },
"node_modules/callsites": { "node_modules/callsites": {
"version": "3.1.0", "version": "3.1.0",
@ -3209,6 +3223,20 @@
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
"dev": true "dev": true
}, },
"node_modules/concat-stream": {
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz",
"integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==",
"engines": [
"node >= 0.8"
],
"dependencies": {
"buffer-from": "^1.0.0",
"inherits": "^2.0.3",
"readable-stream": "^2.2.2",
"typedarray": "^0.0.6"
}
},
"node_modules/convert-source-map": { "node_modules/convert-source-map": {
"version": "1.9.0", "version": "1.9.0",
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz",
@ -3228,6 +3256,11 @@
"url": "https://opencollective.com/core-js" "url": "https://opencollective.com/core-js"
} }
}, },
"node_modules/core-util-is": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="
},
"node_modules/create-require": { "node_modules/create-require": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
@ -3248,6 +3281,35 @@
"node": ">= 8" "node": ">= 8"
} }
}, },
"node_modules/csv": {
"version": "6.3.3",
"resolved": "https://registry.npmjs.org/csv/-/csv-6.3.3.tgz",
"integrity": "sha512-TuOM1iZgdDiB6IuwJA8oqeu7g61d9CU9EQJGzCJ1AE03amPSh/UK5BMjAVx+qZUBb/1XEo133WHzWSwifa6Yqw==",
"dependencies": {
"csv-generate": "^4.2.8",
"csv-parse": "^5.5.0",
"csv-stringify": "^6.4.2",
"stream-transform": "^3.2.8"
},
"engines": {
"node": ">= 0.1.90"
}
},
"node_modules/csv-generate": {
"version": "4.2.8",
"resolved": "https://registry.npmjs.org/csv-generate/-/csv-generate-4.2.8.tgz",
"integrity": "sha512-qQ5CUs4I58kfo90EDBKjdp0SpJ3xWnN1Xk1lZ1ITvfvMtNRf+jrEP8tNPeEPiI9xJJ6Bd/km/1hMjyYlTpY42g=="
},
"node_modules/csv-parse": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/csv-parse/-/csv-parse-5.5.0.tgz",
"integrity": "sha512-RxruSK3M4XgzcD7Trm2wEN+SJ26ChIb903+IWxNOcB5q4jT2Cs+hFr6QP39J05EohshRFEvyzEBoZ/466S2sbw=="
},
"node_modules/csv-stringify": {
"version": "6.4.2",
"resolved": "https://registry.npmjs.org/csv-stringify/-/csv-stringify-6.4.2.tgz",
"integrity": "sha512-DXIdnnCUQYjDKTu6TgCSzRDiAuLxDjhl4ErFP9FGMF3wzBGOVMg9bZTLaUcYtuvhXgNbeXPKeaRfpgyqE4xySw=="
},
"node_modules/debug": { "node_modules/debug": {
"version": "4.3.4", "version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
@ -3512,6 +3574,29 @@
"node": ">=6.9.0" "node": ">=6.9.0"
} }
}, },
"node_modules/geojson-stream": {
"version": "0.0.0",
"resolved": "https://registry.npmjs.org/geojson-stream/-/geojson-stream-0.0.0.tgz",
"integrity": "sha512-fvNmO6ljDiAFojEnBTMxqctPnRjuz+Pme3pdQ8voLVlAu2UVmXaQC7f9iKjrDh9fRnXgr9HNGrj+lZFH0cjPHQ==",
"dependencies": {
"JSONStream": "~0.7.1",
"through": "~2.3.4"
}
},
"node_modules/geojsontoosm": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/geojsontoosm/-/geojsontoosm-0.0.3.tgz",
"integrity": "sha512-tewr/qmOVZ5jB3bBWTqQJwWiM/TFachoQfo3HZVoxXbuhf76tIsCccISEH5nybzfMPbRZhmmd0QtkIQLZlekdQ==",
"dependencies": {
"concat-stream": "^1.5.0",
"geojson-stream": "0.0.0",
"jxon": "^1.3.2",
"optimist": "^0.6.1"
},
"bin": {
"geojsontoosm": "geojsontoosm"
}
},
"node_modules/get-caller-file": { "node_modules/get-caller-file": {
"version": "2.0.5", "version": "2.0.5",
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
@ -3672,8 +3757,7 @@
"node_modules/inherits": { "node_modules/inherits": {
"version": "2.0.4", "version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
"dev": true
}, },
"node_modules/is-arrayish": { "node_modules/is-arrayish": {
"version": "0.2.1", "version": "0.2.1",
@ -3765,6 +3849,11 @@
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ=="
},
"node_modules/isexe": { "node_modules/isexe": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
@ -5484,6 +5573,34 @@
"node": ">=6" "node": ">=6"
} }
}, },
"node_modules/jsonparse": {
"version": "0.0.5",
"resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-0.0.5.tgz",
"integrity": "sha512-fw7Q/8gFR8iSekUi9I+HqWIap6mywuoe7hQIg3buTVjuZgALKj4HAmm0X6f+TaL4c9NJbvyFQdaI2ppr5p6dnQ==",
"engines": [
"node >= 0.2.0"
]
},
"node_modules/JSONStream": {
"version": "0.7.4",
"resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-0.7.4.tgz",
"integrity": "sha512-hVgF0Ox1AtvxJmpwzb2dOEUz2ms1J8DZVbqKUSIGSyPBPy0MuxCJsQxj8y5dadTzsjI+T4TpyyhXORPdz15m9w==",
"dependencies": {
"jsonparse": "0.0.5",
"through": ">=2.2.7 <3"
},
"engines": {
"node": "*"
}
},
"node_modules/jxon": {
"version": "1.6.1",
"resolved": "https://registry.npmjs.org/jxon/-/jxon-1.6.1.tgz",
"integrity": "sha512-P7PSB2SB+k9k0tqwvXKh1a+D2DrLJO1OTvz9KLHLuXkY4KXn0Nk+Z0dnAZxbKQIzLnT8B4/y7TuQ6rldTy+VcA==",
"dependencies": {
"xmldom": "0.1.19"
}
},
"node_modules/kleur": { "node_modules/kleur": {
"version": "3.0.3", "version": "3.0.3",
"resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz",
@ -5526,6 +5643,12 @@
"integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==", "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==",
"dev": true "dev": true
}, },
"node_modules/lodash.memoize": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz",
"integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==",
"dev": true
},
"node_modules/loglevel": { "node_modules/loglevel": {
"version": "1.8.1", "version": "1.8.1",
"resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.8.1.tgz", "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.8.1.tgz",
@ -5805,6 +5928,20 @@
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/optimist": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz",
"integrity": "sha512-snN4O4TkigujZphWLN0E//nQmm7790RYaE53DdL7ZYwee2D8DDo9/EyYiKUfN3rneWUjhJnueija3G9I2i0h3g==",
"dependencies": {
"minimist": "~0.0.1",
"wordwrap": "~0.0.2"
}
},
"node_modules/optimist/node_modules/minimist": {
"version": "0.0.10",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz",
"integrity": "sha512-iotkTvxc+TwOm5Ieim8VnSNvCDjCK9S8G3scJ50ZthspSxa7jx50jkhYduuAtAjvfDUwSgOwf8+If99AlOEhyw=="
},
"node_modules/p-limit": { "node_modules/p-limit": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",
@ -5972,6 +6109,11 @@
"url": "https://github.com/chalk/ansi-styles?sponsor=1" "url": "https://github.com/chalk/ansi-styles?sponsor=1"
} }
}, },
"node_modules/process-nextick-args": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
},
"node_modules/prompts": { "node_modules/prompts": {
"version": "2.4.2", "version": "2.4.2",
"resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz",
@ -6013,6 +6155,20 @@
"integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==",
"dev": true "dev": true
}, },
"node_modules/readable-stream": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz",
"integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==",
"dependencies": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
"isarray": "~1.0.0",
"process-nextick-args": "~2.0.0",
"safe-buffer": "~5.1.1",
"string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1"
}
},
"node_modules/readdirp": { "node_modules/readdirp": {
"version": "3.6.0", "version": "3.6.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
@ -6152,6 +6308,11 @@
"node": ">=10" "node": ">=10"
} }
}, },
"node_modules/safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
},
"node_modules/semver": { "node_modules/semver": {
"version": "6.3.1", "version": "6.3.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
@ -6270,6 +6431,19 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/stream-transform": {
"version": "3.2.8",
"resolved": "https://registry.npmjs.org/stream-transform/-/stream-transform-3.2.8.tgz",
"integrity": "sha512-NUx0mBuI63KbNEEh9Yj0OzKB7iMOSTpkuODM2G7By+TTVihEIJ0cYp5X+pq/TdJRlsznt6CYR8HqxexyC6/bTw=="
},
"node_modules/string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"dependencies": {
"safe-buffer": "~5.1.0"
}
},
"node_modules/string-length": { "node_modules/string-length": {
"version": "4.0.2", "version": "4.0.2",
"resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz",
@ -6377,6 +6551,11 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/through": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
"integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg=="
},
"node_modules/tmpl": { "node_modules/tmpl": {
"version": "1.0.5", "version": "1.0.5",
"resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz",
@ -6416,6 +6595,82 @@
"nodetouch": "bin/nodetouch.js" "nodetouch": "bin/nodetouch.js"
} }
}, },
"node_modules/ts-jest": {
"version": "29.1.1",
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.1.tgz",
"integrity": "sha512-D6xjnnbP17cC85nliwGiL+tpoKN0StpgE0TeOjXQTU6MVCfsB4v7aW05CgQ/1OywGb0x/oy9hHFnN+sczTiRaA==",
"dev": true,
"dependencies": {
"bs-logger": "0.x",
"fast-json-stable-stringify": "2.x",
"jest-util": "^29.0.0",
"json5": "^2.2.3",
"lodash.memoize": "4.x",
"make-error": "1.x",
"semver": "^7.5.3",
"yargs-parser": "^21.0.1"
},
"bin": {
"ts-jest": "cli.js"
},
"engines": {
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
},
"peerDependencies": {
"@babel/core": ">=7.0.0-beta.0 <8",
"@jest/types": "^29.0.0",
"babel-jest": "^29.0.0",
"jest": "^29.0.0",
"typescript": ">=4.3 <6"
},
"peerDependenciesMeta": {
"@babel/core": {
"optional": true
},
"@jest/types": {
"optional": true
},
"babel-jest": {
"optional": true
},
"esbuild": {
"optional": true
}
}
},
"node_modules/ts-jest/node_modules/lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"dev": true,
"dependencies": {
"yallist": "^4.0.0"
},
"engines": {
"node": ">=10"
}
},
"node_modules/ts-jest/node_modules/semver": {
"version": "7.5.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
"dev": true,
"dependencies": {
"lru-cache": "^6.0.0"
},
"bin": {
"semver": "bin/semver.js"
},
"engines": {
"node": ">=10"
}
},
"node_modules/ts-jest/node_modules/yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
"dev": true
},
"node_modules/ts-node": { "node_modules/ts-node": {
"version": "10.9.1", "version": "10.9.1",
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz",
@ -6486,6 +6741,11 @@
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/typedarray": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
"integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA=="
},
"node_modules/typescript": { "node_modules/typescript": {
"version": "5.1.6", "version": "5.1.6",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz",
@ -6575,6 +6835,11 @@
"browserslist": ">= 4.21.0" "browserslist": ">= 4.21.0"
} }
}, },
"node_modules/util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
},
"node_modules/v8-compile-cache-lib": { "node_modules/v8-compile-cache-lib": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
@ -6619,6 +6884,14 @@
"node": ">= 8" "node": ">= 8"
} }
}, },
"node_modules/wordwrap": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz",
"integrity": "sha512-1tMA907+V4QmxV7dbRvb4/8MaRALK6q9Abid3ndMYnbyo8piisCmeONVqVSXqQA3KaP4SLt5b7ud6E2sqP8TFw==",
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/wrap-ansi": { "node_modules/wrap-ansi": {
"version": "7.0.0", "version": "7.0.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
@ -6688,6 +6961,15 @@
"node": "^12.13.0 || ^14.15.0 || >=16.0.0" "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
} }
}, },
"node_modules/xmldom": {
"version": "0.1.19",
"resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.1.19.tgz",
"integrity": "sha512-pDyxjQSFQgNHkU+yjvoF+GXVGJU7e9EnOg/KcGMDihBIKjTsOeDYaECwC/O9bsUWKY+Sd9izfE43JXC46EOHKA==",
"deprecated": "Deprecated due to CVE-2021-21366 resolved in 0.5.0",
"engines": {
"node": ">=0.1"
}
},
"node_modules/y18n": { "node_modules/y18n": {
"version": "5.0.8", "version": "5.0.8",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",

View File

@ -78,7 +78,55 @@ describe('mapping properties with rich mapping engine', () => {
test('conditional phone transform', () => { test('conditional phone transform', () => {
let Mapping_engine = new mapping_engine(mappingPhone) let Mapping_engine = new mapping_engine(mappingPhone)
let mapped_point = Mapping_engine.mapElementFromConf(feature_to_test) let mapped_point = Mapping_engine.mapElementFromConf(feature_to_test)
expect(mapped_point.properties).toStrictEqual({ phone: '+33123456789' }) let expected_converted_phone = '+33 1 23 45 67 89'
expect(mapped_point.properties).toStrictEqual({ phone: expected_converted_phone })
feature_to_test.properties.telephone_operateur = '3615'
expected_converted_phone = '+33 36 15'
mapped_point = Mapping_engine.mapElementFromConf(feature_to_test)
expect(mapped_point.properties).toStrictEqual({ phone: expected_converted_phone })
feature_to_test.properties.telephone_operateur = '+33 6 12928883'
expected_converted_phone = '+33 6 12 92 88 83'
mapped_point = Mapping_engine.mapElementFromConf(feature_to_test)
expect(mapped_point.properties).toStrictEqual({ phone: expected_converted_phone })
feature_to_test.properties.telephone_operateur = '+(33)-(9)-69366018'
expected_converted_phone = '+33 9 69 36 60 18'
mapped_point = Mapping_engine.mapElementFromConf(feature_to_test)
expect(mapped_point.properties).toStrictEqual({ phone: expected_converted_phone })
feature_to_test.properties.telephone_operateur = '0811 69 06 06'
expected_converted_phone = '+33 8 11 69 06 06'
mapped_point = Mapping_engine.mapElementFromConf(feature_to_test)
expect(mapped_point.properties).toStrictEqual({ phone: expected_converted_phone })
feature_to_test.properties.telephone_operateur = '+ 33 1 30 31 30 46 (numéro unique)'
expected_converted_phone = '+33 1 30 31 30 46'
mapped_point = Mapping_engine.mapElementFromConf(feature_to_test)
expect(mapped_point.properties).toStrictEqual({ phone: expected_converted_phone })
feature_to_test.properties.telephone_operateur = '+ 3 3 1 3 0 3 13046 (numéro unique)'
expected_converted_phone = '+33 1 30 31 30 46'
mapped_point = Mapping_engine.mapElementFromConf(feature_to_test)
expect(mapped_point.properties).toStrictEqual({ phone: expected_converted_phone })
feature_to_test.properties.telephone_operateur = '3 56 80 09'
expected_converted_phone = '+33 3 56 80 09'
mapped_point = Mapping_engine.mapElementFromConf(feature_to_test)
expect(mapped_point.properties).toStrictEqual({ phone: expected_converted_phone })
feature_to_test.properties.telephone_operateur = '+ 33 1 30 31 30 46 (numéro unique)'
expected_converted_phone = '+33 1 30 31 30 46'
mapped_point = Mapping_engine.mapElementFromConf(feature_to_test)
expect(mapped_point.properties).toStrictEqual({ phone: expected_converted_phone })
feature_to_test.properties.telephone_operateur = 'Stations-e'
mapped_point = Mapping_engine.mapElementFromConf(feature_to_test)
expect(mapped_point.properties).toStrictEqual({ })
// +19 0142056650;+19 0664534050
}) })
}) })

View File

@ -1 +1 @@
[out:csv(::lon,::lat,id,capacity,name,ref,phone,contact)][timeout:25];{{geocodeArea:Essonne}}->.searchArea; (node["amenity"="charging_station"](area.searchArea);); out center; [out:csv(::lon,::lat,id,capacity,name,ref,phone,contact)][timeout:25];area(id:3600007401)->.searchArea;+(node["amenity"="charging_station"](area.searchArea););+out+center;