How to use the name-suggestion-index.wikidata 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 / build_data.js View on Github external
function suggestionsToPresets(presets) {
  const brands = nsi.brands.brands;
  const wikidata = nsi.wikidata.wikidata;

  Object.keys(brands).forEach(kvnd => {
    const suggestion = brands[kvnd];
    const qid = suggestion.tags['brand:wikidata'];
    if (!qid || !/^Q\d+$/.test(qid)) return;   // wikidata tag missing or looks wrong..

    const parts = kvnd.split('|', 2);
    const kv = parts[0];
    const name = parts[1].replace('~', ' ');

    let presetID, preset;

    // sometimes we can choose a more specific preset then key/value..
    if (suggestion.tags.cuisine) {
      // cuisine can contain multiple values, so try them all in order
      let cuisines = suggestion.tags.cuisine.split(';');

name-suggestion-index

Canonical common brand names for OpenStreetMap

BSD-3-Clause
Latest version published 4 days ago

Package Health Score

88 / 100
Full package analysis