How to use the @terrestris/base-util/dist/StringUtil/StringUtil.urlify function in @terrestris/base-util

To help you get started, we’ve selected a few @terrestris/base-util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github terrestris / ol-util / src / FeatureUtil / FeatureUtil.js View on Github external
// present or value is null).
        if (noMatchCnt === Object.keys(feature.getProperties()).length) {
          template = template.replace(res, noValueFoundText);
        }
      });
    }

    resolved = template;

    // Fallback if no feature attribute is found.
    if (!resolved) {
      resolved = feature.getId();
    }

    // Replace any HTTP url with an <a> element.
    resolved = StringUtil.urlify(resolved);

    // Replace all newline breaks with a html <br> tag.
    resolved = resolved.replace(/\n/g, '<br>');

    return resolved;
  }
}</a>