<commit_before>const bodyParser = require('body-parser')
const jsonParser = bodyParser.json()

module.exports = (app) => {
  const fetch = require('../fetch')(app)
  app.get('/api/v1/libraries', jsonParser, (request, response) => {
    fetch('http://xkoha:8081/api/v1/libraries')
    .then(res => {
      if (res.status === 200) {
        return res.json()
      } else {
        response.status(res.status).send(res.statusText)
        throw Error()
      }
    }).then(json => response.status(200).send(json))
      .catch(error => {
        console.log(error)
        response.sendStatus(500)
      })
  })
}
<commit_msg>patron-client: DEICH-282 - filter branches<commit_after>const bodyParser = require('body-parser')
const jsonParser = bodyParser.json()

module.exports = (app) => {
  const fetch = require('../fetch')(app)
  app.get('/api/v1/libraries', jsonParser, (request, response) => {
    fetch('http://xkoha:8081/api/v1/libraries')
    .then(res => {
      if (res.status === 200) {
        return res.json()
      } else {
        response.status(res.status).send(res.statusText)
        throw Error()
      }
    }).then(json => response.status(200).send(filterLibraries(json)))
      .catch(error => {
        console.log(error)
        response.sendStatus(500)
      })
  })

  function filterLibraries (libraries) {
    return libraries.filter(library => {
      if (!['api', 'frik', 'hsko', 'fgam', 'ukjent'].includes(library.branchcode)) { return true }
    })
  }
}

{'fraction_non_alphanumeric': 0.18022864828513785, 'fraction_numerical': 0.02219233355749832, 'mean_word_length': 2.8350515463917527, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 14, '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': '524699', 'n_tokens_mistral': 510, 'n_tokens_neox': 487, 'n_words': 78}