<commit_before>const config = {}

const instanceMap = {}

export function init (cfg) {
  config.Document = cfg.Document
  config.Element = cfg.Element
  config.Comment = cfg.Comment
  config.sendTasks = cfg.sendTasks
}

export function registerComponents (components) {}

export function registerModules (modules) {}

export function registerMethods (apis) {}

export function prepareInstance (id, options, data) {}

export function createInstance (id, code, options, data) {
  const document = new config.Document(id, options.bundleUrl)
  const callbacks = {};
  let lastCallbackId = 0;
  document.addCallback = func => {
    lastCallbackId++
    callbacks[lastCallbackId] = func
    return lastCallbackId
  }
  document.handleCallback = (funcId, data, ifLast) => {
    const callback = callbacks[funcId]
    if (ifLast) {
      delete callbacks[funcId]
    }
    return callback(data)
  }
  instanceMap[id] = document
  const result = new Function(
    'Document',
    'Element',
    'Comment',
    'sendTasks',
    'id',
    'options',
    'data',
    'document',
    code
  )
  return result(
    config.Document,
    config.Element,
    config.Comment,
    config.sendTasks,
    id,
    options,
    data,
    document
  )
}

export function refreshInstance (id, data) {}

export function destroyInstance (id) {
  delete instanceMap[id];
}

export function getRoot (id) {
  return instanceMap[id].body.toJSON();
}
<commit_msg>* [jsfm] passed eslint<commit_after>const config = {}

const instanceMap = {}

export function init (cfg) {
  config.Document = cfg.Document
  config.Element = cfg.Element
  config.Comment = cfg.Comment
  config.sendTasks = cfg.sendTasks
}

export function registerComponents (components) {}

export function registerModules (modules) {}

export function registerMethods (apis) {}

export function prepareInstance (id, options, data) {}

export function createInstance (id, code, options, data) {
  const document = new config.Document(id, options.bundleUrl)
  const callbacks = {}
  let lastCallbackId = 0
  document.addCallback = func => {
    lastCallbackId++
    callbacks[lastCallbackId] = func
    return lastCallbackId
  }
  document.handleCallback = (funcId, data, ifLast) => {
    const callback = callbacks[funcId]
    if (ifLast) {
      delete callbacks[funcId]
    }
    return callback(data)
  }
  instanceMap[id] = document
  const result = new Function(
    'Document',
    'Element',
    'Comment',
    'sendTasks',
    'id',
    'options',
    'data',
    'document',
    code
  )
  return result(
    config.Document,
    config.Element,
    config.Comment,
    config.sendTasks,
    id,
    options,
    data,
    document
  )
}

export function refreshInstance (id, data) {}

export function destroyInstance (id) {
  delete instanceMap[id]
}

export function getRoot (id) {
  return instanceMap[id].body.toJSON()
}

{'fraction_non_alphanumeric': 0.11126613184513429, 'fraction_numerical': 0.0006975933031042902, 'mean_word_length': 3.453416149068323, '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': '5358251', 'n_tokens_mistral': 865, 'n_tokens_neox': 864, 'n_words': 229}