<commit_before>/**
 * LokiJS
 * @author <NAME> <<EMAIL>>
 *
 * A lightweight document oriented javascript database
 */
(function (root, factory) {
  if (typeof define === 'function' && define.amd) {
    // AMD
    define([], factory);
  } else if (typeof exports === 'object') {
    // CommonJS
    module.exports = factory();
  } else {
    // Browser globals
    root.loki = factory();
  }
}(this, function () {

  return (function () {
    'use strict';

    var Utils = {
      copyProperties: function (src, dest) {
        var prop;
        for (prop in src) {
          dest[prop] = src[prop];
        }
      }
    };

    var LokiOps = {
      // comparison operators
      $eq: function (a, b) {
        return a === b;
      },

      $gt: function (a, b) {
        return a > b;
      },

      $gte: function (a, b) {
        return a >= b;
      },

      $lt: function (a, b) {
        return a < b;
      },

      $lte: function (a, b) {
        return a <= b;
      },

      $ne: function (a, b) {
        return a !== b;
      },

      $regex: function (a, b) {
        return b.test(a);
      },

      $in: function (a, b) {
        return b.indexOf(a) > -1;
      },

      $contains: function (a, b) {
        if (Array.isArray(a)) {
          return a.indexOf(b) !== -1;
        }

        if (typeof a === 'string') {
          return a.indexOf(b) !== -1;
        }

        if (a && typeof a === 'object') {
          return a.hasOwnProperty(b);
        }

      }
    };
    var fs = (typeof exports === 'object') ? require('fs') : false;

    function clone(data, method) {
      var cloneMethod = method || 'parse-stringify',
        cloned;
      if (cloneMethod === 'parse-stringify') {
        cloned = JSON.parse(JSON.stringify(data));
      }
      return cloned;
    }

    function localStorageAvailable() {
      try {
        return ('localStorage' in window && window['localStorage'] !== null);<commit_msg>$contains with arrays in document<commit_after>/**
 * LokiJS
 * @author <NAME> <<EMAIL>>
 *
 * A lightweight document oriented javascript database
 */
(function (root, factory) {
  if (typeof define === 'function' && define.amd) {
    // AMD
    define([], factory);
  } else if (typeof exports === 'object') {
    // CommonJS
    module.exports = factory();
  } else {
    // Browser globals
    root.loki = factory();
  }
}(this, function () {

  return (function () {
    'use strict';

    var Utils = {
      copyProperties: function (src, dest) {
        var prop;
        for (prop in src) {
          dest[prop] = src[prop];
        }
      }
    };

    var LokiOps = {
      // comparison operators
      $eq: function (a, b) {
        return a === b;
      },

      $gt: function (a, b) {
        return a > b;
      },

      $gte: function (a, b) {
        return a >= b;
      },

      $lt: function (a, b) {
        return a < b;
      },

      $lte: function (a, b) {
        return a <= b;
      },

      $ne: function (a, b) {
        return a !== b;
      },

      $regex: function (a, b) {
        return b.test(a);
      },

      $in: function (a, b) {
        return b.indexOf(a) > -1;
      },

      $contains: function (a, b) {
        var checkFn = function() { return true; };
        
        if(!Array.isArray(b)) {
          b = [ b ];
        }
        
        if (Array.isArray(a)) {
          checkFn = function(curr) {
            return a.indexOf(curr) !== -1;
          };
        }
        
        if (typeof a === 'string') {
          checkFn = function(curr) {
            return a.indexOf(curr) !== -1;
          };
        }
    
        if (a && typeof a === 'object') {
          checkFn = function(curr) {
            return a.hasOwnProperty(curr);
          };
        }
        
        return b.reduce(function(prev, curr) {
          if(!prev) {
            return prev;
          }
          
          return checkFn(curr);
        }, true);
      }
    };
    var fs = (typeof exports === 'object') ? require('fs') : false;

    function clone(data, method) {
      var cloneMethod = method || 'parse-stringify',
        cloned;
      if (cloneMethod === 'parse-stringify') {
        cloned = JSON.parse(JSON.stringify(data));
      }
      return cloned;
    }

    function localStorageAvailable() {
      try {
        return ('localStorage' in window && window['localStorage'] !== null);
{'fraction_non_alphanumeric': 0.15848112778535697, 'fraction_numerical': 0.001364256480218281, 'mean_word_length': 1.5665110851808635, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, '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': '4174374', 'n_tokens_mistral': 1390, 'n_tokens_neox': 1355, 'n_words': 362}