<commit_before>_ = require "underscore"
Immutable = require "immutable"

class Utils
  builtInClassMethods: Object.getOwnPropertyNames (class Noop).prototype

  getInternalMethods: (cls) ->
    methods = {}
    for name in Object.getOwnPropertyNames(cls.prototype)
      method = cls.prototype[name]
      continue unless @builtInClassMethods.indexOf(name) is -1
      continue unless _.isFunction method
      methods[name] = method

    methods

  isPromise: (value) ->
    value and
    (typeof value in ["object", "function"]) and
    (typeof value.then is "function")

  isCursor: (value) ->
    value and
    (typeof value is "object") and
    (typeof value.cursor is "function")

  isImmutable: (value) ->
    Immutable.Iterable.isIterable value

  hasBlobURLSupport: ->
    window and
    "URL" of window and
    "revokeObjectURL" of window.URL and
    "createObjectURL" of window.URL

module.exports = new Utils<commit_msg>Put the utils package on a diet<commit_after>_ = require "underscore"
class Utils
  builtInClassMethods: Object.getOwnPropertyNames (class Noop).prototype

  getInternalMethods: (cls) ->
    methods = {}
    for name in Object.getOwnPropertyNames(cls.prototype)
      method = cls.prototype[name]
      continue unless @builtInClassMethods.indexOf(name) is -1
      continue unless _.isFunction method
      methods[name] = method

    methods

module.exports = new Utils
{'fraction_non_alphanumeric': 0.09265858873841767, 'fraction_numerical': 0.0014255167498218105, 'mean_word_length': 3.514469453376206, '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': '3778709', 'n_tokens_mistral': 408, 'n_tokens_neox': 405, 'n_words': 119}