Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

Top 10 Examples of "pelias-config in functional component" in JavaScript

Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'pelias-config' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.

// http://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-root-object-type.html#_dynamic_templates

const elastictest = require('elastictest');
const config = require('pelias-config').generate();

module.exports.tests = {};

module.exports.tests.dynamic_templates_name = function(test, common){
  test( 'document->name', nameAssertion( 'peliasIndexOneEdgeGram', common ) );
};

module.exports.tests.dynamic_templates_phrase = function(test, common){
  test( 'document->phrase', phraseAssertion( 'peliasPhrase', common ) );
};

module.exports.tests.dynamic_templates_addendum = function(test, common){
  test( 'addendum', addendumAssertion( 'wikipedia', JSON.stringify({ slug: 'Wikipedia' }), common ) );
};

module.exports.all = function (tape, common) {
var peliasConfig = require( 'pelias-config' ).generate(require('./schema'));
var readStreamModule = require('./src/readStream');
var importStream = require('./src/importStream');
var peliasDbclient = require( 'pelias-dbclient' );
var peliasDocGenerators = require('./src/peliasDocGenerators');
var hierarchyFinder = require('./src/hierarchyFinder');
var bundles = require('./src/bundleList');

const logger = require( 'pelias-logger' ).get( 'whosonfirst' );

// a cache of only admin records, to be used to fill the hierarchy
// of other, lower admin records as well as venues
var wofAdminRecords = {};

bundles.generateBundleList((err, bundlesToImport) => {

  if (err) {
function extract(options, callback){

  // load configuration variables
  const config = require('pelias-config').generate(require('../schema')).imports.whosonfirst;

  // location of data and meta dirs
  const metaDir = path.join(config.datapath, 'meta');
  const dataDir = path.join(config.datapath, 'data');
  const sqliteDir = path.join(config.datapath, 'sqlite');

  // unlink (truncate meta and data dirs)
  if( options && true === options.unlink ){
    fs.removeSync(metaDir);
    fs.removeSync(dataDir);
  }

  // ensure required directory structure exists
  fs.ensureDirSync(metaDir);
  fs.ensureDirSync(dataDir);
  fs.ensureDirSync(sqliteDir);
/**
  The pbf parser is responsible for configuring and executing a pbf parser and
  returning a valid readable stream.
**/

var fs = require('fs'),
    pbf2json = require('pbf2json'),
    settings = require('pelias-config').generate(require('../schema')),
    features = require('../config/features'),
    path = require('path');

// Create a new pbf parser stream
function createPbfStream(opts){

  var conf = config(opts);

  validatePath( conf.file, 'failed to stat pbf file: ' + conf.file );
  validatePath( conf.leveldb, 'failed to stat leveldb path: ' + conf.leveldb );
  validateTags( conf.tags );

  return pbf2json.createReadStream(conf);
}

// Generate configuration options for pbf2json, apply default
const _ = require('lodash');
const peliasQuery = require('pelias-query');
const defaults = require('./search_defaults');
const textParser = require('./text_parser_pelias');
const config = require('pelias-config').generate().api;

var placeTypes = require('../helper/placeTypes');
var views = { custom_boosts: require('./view/boost_sources_and_layers') };

// region_a is also an admin field which can be identified by
// the pelias_parser. this functionality was inherited from the
// previous parser we used prior to the creation of pelias_parser.
var adminFields = placeTypes.concat(['region_a']);

//------------------------------
// general-purpose search query
//------------------------------
var query = new peliasQuery.layout.FilteredBooleanQuery();

// mandatory matches
query.score( peliasQuery.view.ngrams, 'must' );
const _ = require('lodash');
const path = require('path');
const schema = require('../');
const fixture = require('./fixtures/expected.json');
const config = require('pelias-config').generate();

const forEachDeep = (obj, cb) =>
  _.forEach(obj, (val, key) => {
    cb(val, key);
    if (_.isPlainObject(val) || _.isArray(val)){
      forEachDeep(val, cb);
    }
  });

module.exports.tests = {};

module.exports.tests.compile = function(test, common) {
  test('valid schema file', function(t) {
    t.equal(typeof schema, 'object', 'schema generated');
    t.equal(Object.keys(schema).length>0, true, 'schema has body');
    t.end();
generate: function() {
      return realPeliasConfig.generateCustom(customConfig);
    }
  };
generate: function() {
        return realPeliasConfig.generateCustom(custom_config);
      }
    };
generate: function() {
    return realPeliasConfig.defaults;
  }
};
generate: function() {
    return realPeliasConfig.generateDefaults();
  }
};

Is your System Free of Underlying Vulnerabilities?
Find Out Now