<commit_before>util = require 'util'

exports.is =
  fun: util.isFunction
  str: util.isString
  arr: util.isArray
  obj: util.isObject

exports.normalize = (params, options, fn) ->
  if util.isFunction params
    fn = params
    params = null
    options = null
  else if util.isFunction options
    fn = options
    options = null

  if not util.isFunction fn
    fn = ->

  {params, options, fn}<commit_msg>Revert "Replace validation to node built-in functions"<commit_after>fun = (f) -> typeof f is 'function'
str = (s) -> typeof s is 'string'
arr = (a) -> a instanceof Array
obj = (o) -> o instanceof Object and not fun(o) and not arr(o)

exports.is =
  fun: fun
  str: str
  arr: arr
  obj: obj

exports.normalize = (params, options, fn) ->
  if fun params
    fn = params
    params = null
    options = null
  else if fun options
    fn = options
    options = null

  if not fun fn
    fn = ->

  {params, options, fn}
{'fraction_non_alphanumeric': 0.10679611650485436, 'fraction_numerical': 0.0, 'mean_word_length': 2.7269076305220885, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '4692426', 'n_tokens_mistral': 310, 'n_tokens_neox': 305, 'n_words': 112}