<commit_before>'use strict'
exports.id = contextId
// ----------------- TRY TO REMOVE ORDER/CL ONE CASE -------------------
exports.order = function (_, id, obs, parent) {
  const index = obs.index
  if (index !== void 0) {
    const keys = parent.keys()
    let nextChild = parent[keys[index + 1]]
    if (
      nextChild &&
      nextChild.isElement &&
      !nextChild.isStatic &&
      nextChild.__c &&
      (!_.cl || !_.cl[id])
    ) {
      if (!_.cl) { _.cl = {} }
      _.cl[id] = contextId(nextChild)
    }
  }
}

function contextId (obs) {
  if (obs.storeContextKey) {
    return 'c' + obs.cParent().key + '-' + genCid(obs)
  } else {
    return 'c' + genCid(obs)
  }
}

function genCid (obs) {
  if (obs.__c) {
    if (obs._cLevel === 1) {
      return obs.uid() + '' + genCid(obs.__c)
    } else {
      return obs.uid() + '' + genCid(obs._parent)
    }
  } else {
    return obs.uid()
  }
}<commit_msg>dont add key to cid if undefined<commit_after>'use strict'
exports.id = contextId
// ----------------- TRY TO REMOVE ORDER/CL ONE CASE -------------------
exports.order = function (_, id, obs, parent) {
  const index = obs.index
  if (index !== void 0) {
    const keys = parent.keys()
    let nextChild = parent[keys[index + 1]]
    if (
      nextChild &&
      nextChild.isElement &&
      !nextChild.isStatic &&
      nextChild.__c &&
      (!_.cl || !_.cl[id])
    ) {
      if (!_.cl) { _.cl = {} }
      _.cl[id] = contextId(nextChild)
    }
  }
}

function contextId (obs) {
  if (obs.storeContextKey) {
    const key = obs.cParent().key
    return key ? 'c' + key + '-' + genCid(obs) : 'c' + genCid(obs)
  } else {
    return 'c' + genCid(obs)
  }
}

function genCid (obs) {
  if (obs.__c) {
    if (obs._cLevel === 1) {
      return obs.uid() + '' + genCid(obs.__c)
    } else {
      return obs.uid() + '' + genCid(obs._parent)
    }
  } else {
    return obs.uid()
  }
}
{'fraction_non_alphanumeric': 0.20431806213796735, 'fraction_numerical': 0.00315955766192733, 'mean_word_length': 1.9827315541601256, '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': '3616294', 'n_tokens_mistral': 698, 'n_tokens_neox': 686, 'n_words': 156}