How to use the name-suggestion-index.filters.discardNames function in name-suggestion-index

To help you get started, we’ve selected a few name-suggestion-index 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 openstreetmap / iD / modules / validations / suspicious_name.js View on Github external
export function validationSuspiciousName() {
    var type = 'suspicious_name';

    // known list of generic names (e.g. "bar")
    var discardNamesRegexes = filters.discardNames.map(function(discardName) {
        return new RegExp(discardName, 'i');
    });

    var keysToTestForGenericValues = ['amenity', 'building', 'leisure', 'man_made', 'shop', 'tourism'];

    function isDiscardedSuggestionName(lowercaseName) {
        for (var i = 0; i < discardNamesRegexes.length; i++) {
            if (discardNamesRegexes[i].test(lowercaseName)) {
                return true;
            }
        }
        return false;
    }

    // test if the name is just the key or tag value (e.g. "park")
    function nameMatchesRawTag(lowercaseName, tags) {

name-suggestion-index

Canonical common brand names for OpenStreetMap

BSD-3-Clause
Latest version published 6 days ago

Package Health Score

88 / 100
Full package analysis