<commit_before>'use strict'

const Koa = require('koa')
const bodyParser = require('koa-bodyparser')
const logger = require('koa-logger')
const { get, post } = require('koa-route')
const uuidv4 = require('uuid/v4')
const zipObject = require('lodash.zipobject')

const app = new Koa()
const donuts = new Map()
const port = 3000

app.use(bodyParser())

if (process.env.NODE_ENV !== 'test') app.use(logger())


app.use(get('/', (ctx) => {
  ctx.body = '👹 🍩  nom nom nom DONUTS!!!\n'
}))
app.use(get('/donuts', (ctx) => {
  ctx.body = zipObject(Array.from(donuts.entries()))
}))
app.use(get('/donuts/:id', (ctx, id) => {
  if (!donuts.has(id)) {
    return ctx.throw(404, `${id} not found`)
  }
  ctx.body = {
    [id]: donuts.get(id)
  }
}))
app.use(post('/donuts', (ctx) => {
  const id = uuidv4()
  // TODO: validate
  donuts.set(uuidv4(), ctx.request.body)

  ctx.body = {
    [id]: ctx.request.body
  }
}))

if (!module.parent) {
  app.listen(port)
  console.log(`donut-monster listening on ${port}`)
}

module.exports = app
<commit_msg>style(monster): remove extra trailing line<commit_after>'use strict'

const Koa = require('koa')
const bodyParser = require('koa-bodyparser')
const logger = require('koa-logger')
const { get, post } = require('koa-route')
const uuidv4 = require('uuid/v4')
const zipObject = require('lodash.zipobject')

const app = new Koa()
const donuts = new Map()
const port = 3000

app.use(bodyParser())

if (process.env.NODE_ENV !== 'test') app.use(logger())

app.use(get('/', (ctx) => {
  ctx.body = '👹 🍩  nom nom nom DONUTS!!!\n'
}))
app.use(get('/donuts', (ctx) => {
  ctx.body = zipObject(Array.from(donuts.entries()))
}))
app.use(get('/donuts/:id', (ctx, id) => {
  if (!donuts.has(id)) {
    return ctx.throw(404, `${id} not found`)
  }
  ctx.body = {
    [id]: donuts.get(id)
  }
}))
app.use(post('/donuts', (ctx) => {
  const id = uuidv4()
  // TODO: validate
  donuts.set(uuidv4(), ctx.request.body)

  ctx.body = {
    [id]: ctx.request.body
  }
}))

if (!module.parent) {
  app.listen(port)
  console.log(`donut-monster listening on ${port}`)
}

module.exports = app

{'fraction_non_alphanumeric': 0.21245247148288973, 'fraction_numerical': 0.010456273764258554, 'mean_word_length': 3.9413145539906105, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '2119453', 'n_tokens_mistral': 834, 'n_tokens_neox': 816, 'n_words': 172}