Sha256: 97071e7ec4da276978359a90a6724a5f8c390fe5ddc4002c9d9b34816a3d1169
Contents?: true
Size: 899 Bytes
Versions: 44
Compression:
Stored size: 899 Bytes
Contents
/* eslint-disable require-jsdoc */ // If you want to customize the geocoder address format which is displayed // when showing the geocoding results list, add this configuration code to // your geocoder at config/initializers/decidim.rb: // config.maps = { // # ... other configs ... // autocomplete: { // address_format: [%w(street houseNumber), "city", "country"] // } // } // // For the available address keys, refer to the provider's own documentation. const compact = (items) => items.filter( (part) => part !== null && typeof part !== "undefined" && `${part}`.trim().length > 0 ); export default function formatAddress(object, keys, separator = ", ") { const parts = keys.map((key) => { if (Array.isArray(key)) { return formatAddress(object, key, " "); } return object[key] || object[key.toLowerCase()]; }) return compact(parts).join(separator).trim(); }
Version data entries
44 entries across 44 versions & 1 rubygems