<commit_before>var tempdown = require('./leveldown')
var levelup = require('levelup')
var xtend = require('xtend')

var temp = function (db, opts) {
  if (!opts) opts = {}

  var tick = 0
  var separator = opts.separator || '!'
  var prefix = opts.prefix ? opts.prefix + separator : ''
  delete opts.prefix

  return function (tmpOpts) {
    tmpOpts = xtend(opts, tmpOpts)
    tmpOpts.db = function () {
      return tempdown(db, prefix + (tmpOpts.prefix || (++tick)), separator)
    }

    return levelup(db.location, tmpOpts)
  }
}

module.exports = temp
<commit_msg>can add prefix as just a string<commit_after>var tempdown = require('./leveldown')
var levelup = require('levelup')
var xtend = require('xtend')

var temp = function (db, opts) {
  if (typeof opts === 'string') opts = {prefix: opts}
  if (!opts) opts = {}

  var tick = 0
  var separator = opts.separator || '!'
  var prefix = opts.prefix ? opts.prefix + separator : ''
  delete opts.prefix

  return function (tmpOpts) {
    if (typeof tmpOpts === 'string') tmpOpts = {prefix: tmpOpts}
    tmpOpts = xtend(opts, tmpOpts)
    tmpOpts.db = function () {
      return tempdown(db, prefix + (tmpOpts.prefix || (++tick)), separator)
    }

    return levelup(db.location, tmpOpts)
  }
}

module.exports = temp

{'fraction_non_alphanumeric': 0.14745098039215687, 'fraction_numerical': 0.001568627450980392, 'mean_word_length': 3.4771929824561405, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5776002', 'n_tokens_mistral': 424, 'n_tokens_neox': 422, 'n_words': 118}