<commit_before>moment = require 'moment'
processSplit = (split) ->
  result = null
  if split.indexOf('|') isnt -1
    splits2 = split.split '|'
    switch splits2[0]
      when "lt"
        result =
          $lt: splits2[1]
      when "ltdate"
        date = moment(splits2[1]
        , ["YYYY-MM-DD", "YYYY-MM-DDTHH:mm:ss"])
        result =
          $lt: date
      when "lte"
        result =
          $lte: splits2[1]
      when "gt"
        result =
          $gt: splits2[1]
      when "gtdate"
        date = moment(splits2[1]
        , ["YYYY-MM-DD", "YYYY-MM-DDTHH:mm:ss"])
        result =
          $gt: date
      when "gte"
        result =
          $gte: splits2[1]
  else
    result = split

  result

processSplits = (splits, k) ->
  results = []

  splits.forEach (split) =>
    obj = {}
    obj[k] = @processSplit split
    results.push obj

  results

module.exports =
  processSplit: processSplit
  processSplits: processSplits
<commit_msg>Added exists and isnull query options<commit_after>moment = require 'moment'
processSplit = (split) ->
  result = null
  if split.indexOf('|') isnt -1
    splits2 = split.split '|'
    switch splits2[0]
      when "lt"
        result =
          $lt: splits2[1]
      when "ltdate"
        date = moment(splits2[1]
        , ["YYYY-MM-DD", "YYYY-MM-DDTHH:mm:ss"])
        result =
          $lt: date
      when "lte"
        result =
          $lte: splits2[1]
      when "gt"
        result =
          $gt: splits2[1]
      when "gtdate"
        date = moment(splits2[1]
        , ["YYYY-MM-DD", "YYYY-MM-DDTHH:mm:ss"])
        result =
          $gt: date
      when "gte"
        result =
          $gte: splits2[1]
      when "exists"
        result =
          $exists: (splits2[1] == "true") ? true : false
  else
    result = split

    switch split
      when "isnull"
        result =
          $type: 10

  result

processSplits = (splits, k) ->
  results = []

  splits.forEach (split) =>
    obj = {}
    obj[k] = @processSplit split
    results.push obj

  results

module.exports =
  processSplit: processSplit
  processSplits: processSplits
{'fraction_non_alphanumeric': 0.13100848256361922, 'fraction_numerical': 0.016965127238454288, 'mean_word_length': 1.8007915567282322, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '4931013', 'n_tokens_mistral': 756, 'n_tokens_neox': 734, 'n_words': 170}