Sha256: a2fa810e5e81282fb797ad59590fe3f0c6e4d0e013aa7e0b654dec35ac91723a

Contents?: true

Size: 1 KB

Versions: 14

Compression:

Stored size: 1 KB

Contents

((exports) => {
  // 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
  );
  const 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();
  }

  exports.Decidim = exports.Decidim || {};
  exports.Decidim.geocodingFormatAddress = formatAddress;
})(window);

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
decidim-core-0.24.3 app/assets/javascripts/decidim/geocoding/format_address.js.es6
decidim-core-0.23.6 app/assets/javascripts/decidim/geocoding/format_address.js.es6
decidim-core-0.24.2 app/assets/javascripts/decidim/geocoding/format_address.js.es6
decidim-core-0.23.5 app/assets/javascripts/decidim/geocoding/format_address.js.es6
decidim-core-0.24.1 app/assets/javascripts/decidim/geocoding/format_address.js.es6
decidim-core-0.24.0 app/assets/javascripts/decidim/geocoding/format_address.js.es6
decidim-core-0.24.0.rc2 app/assets/javascripts/decidim/geocoding/format_address.js.es6
decidim-core-0.23.4 app/assets/javascripts/decidim/geocoding/format_address.js.es6
decidim-core-0.24.0.rc1 app/assets/javascripts/decidim/geocoding/format_address.js.es6
decidim-core-0.23.3 app/assets/javascripts/decidim/geocoding/format_address.js.es6
decidim-core-0.23.2 app/assets/javascripts/decidim/geocoding/format_address.js.es6
decidim-core-0.23.1 app/assets/javascripts/decidim/geocoding/format_address.js.es6
decidim-core-0.23.1.rc1 app/assets/javascripts/decidim/geocoding/format_address.js.es6
decidim-core-0.23.0 app/assets/javascripts/decidim/geocoding/format_address.js.es6