How to use the pelias-model.codec.encode function in pelias-model

To help you get started, we’ve selected a few pelias-model 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 pelias / api / test / unit / helper / geojsonify.js View on Github external
test('addendum: partially corrupted', function(t) {
    var example = [{
      '_id': 'whosonfirst:continent:6295630',
      'source': 'whosonfirst',
      'layer': 'continent',
      'name': {
        'default': 'Earth'
      },
      'center_point': {
        'lon': 0,
        'lat': 0
      },
      'addendum': {
        'wikipedia': codec.encode({ slug: 'HackneyCityFarm' }),
        'geonames': 'INVALID ENCODING'
      }
    }];

    let collection = geojsonify({}, example);
    t.deepEqual(collection.features[0].properties.addendum, {
      wikipedia: { slug: 'HackneyCityFarm' }
    });
    t.end();
  });
  test('addendum: all corrupted', function(t) {
github pelias / api / test / unit / helper / geojsonify.js View on Github external
test('addendum: set in source', function(t) {
    var example = [{
      '_id': 'whosonfirst:continent:6295630',
      'source': 'whosonfirst',
      'layer': 'continent',
      'name': {
        'default': 'Earth'
      },
      'center_point': {
        'lon': 0,
        'lat': 0
      },
      'addendum': {
        'wikipedia': codec.encode({ slug: 'HackneyCityFarm' }),
        'geonames': codec.encode({ foreignkey: 1 })
      }
    }];

    let collection = geojsonify({}, example);
    t.deepEqual(collection.features[0].properties.addendum, {
      wikipedia: { slug: 'HackneyCityFarm' },
      geonames: { foreignkey: 1 }
    });
    t.end();
  });