<commit_before>'use strict';

const request = require('request-promise');
const config = require('../../config');
const transformSectors = require( './transformers/metadata-sectors' );

function getMetadata( path, key ){

  let url = `${config.apiRoot}/metadata/${ path }`;

  return request({
    url,
    json: true
  })
  .then((data) => {

    module.exports[ key ] = data;
    return data;

  }).catch( ( err ) => {

    console.error( 'Error fetching metadata for url: %s', url );
    throw err;
  } );
}

function createSubSectors( data ){

  const splitSectors = transformSectors( data );

  module.exports.PRIMARY_SECTORS = splitSectors.sectors;
  module.exports.SUBSECTORS = splitSectors.subsectors;
}

const metadataItems = [
  [ 'sector/', 'SECTOR_OPTIONS', createSubSectors ],
  [ 'turnover', 'TURNOVER_OPTIONS' ],
  [ 'uk-region', 'REGION_OPTIONS' ],
  [ 'country', 'COUNTRYS' ],
  [ 'employee-range', 'EMPLOYEE_OPTIONS' ],
  [ 'business-type', 'TYPES_OF_BUSINESS' ],
  [ 'team', 'TEAMS' ]
];
<commit_msg>Ensure all calls for metadata end in / (#187)<commit_after>'use strict';

const request = require('request-promise');
const config = require('../../config');
const transformSectors = require( './transformers/metadata-sectors' );

function getMetadata( path, key ){

  let url = `${config.apiRoot}/metadata/${ path }/`;

  return request({
    url,
    json: true
  })
  .then((data) => {

    module.exports[ key ] = data;
    return data;

  }).catch( ( err ) => {

    console.error( 'Error fetching metadata for url: %s', url );
    throw err;
  } );
}

function createSubSectors( data ){

  const splitSectors = transformSectors( data );

  module.exports.PRIMARY_SECTORS = splitSectors.sectors;
  module.exports.SUBSECTORS = splitSectors.subsectors;
}

const metadataItems = [
  [ 'sector', 'SECTOR_OPTIONS', createSubSectors ],
  [ 'turnover', 'TURNOVER_OPTIONS' ],
  [ 'uk-region', 'REGION_OPTIONS' ],
  [ 'country', 'COUNTRYS' ],
  [ 'employee-range', 'EMPLOYEE_OPTIONS' ],
  [ 'business-type', 'TYPES_OF_BUSINESS' ],
  [ 'team', 'TEAMS' ]
];

{'fraction_non_alphanumeric': 0.17198067632850242, 'fraction_numerical': 0.0014492753623188406, 'mean_word_length': 3.838785046728972, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2927551', 'n_tokens_mistral': 741, 'n_tokens_neox': 717, 'n_words': 149}