<commit_before>###
 *  front-end js helpers
 *    0.3.3.alpha / 2010-2011
 *    <NAME> / Evrone.com
 *    koderfunk_at_gmail_dot_com
###

@DEBUG_MODE ?= false
@TEST_MODE ?= false
@LOG_TODO ?= true

@cout = =>
  args = _.toArray(arguments)
  method = if args[0] in ['log', 'info', 'warn', 'error', 'assert', 'clear'] then args.shift() else 'log'
  if @DEBUG_MODE and console?
    method = console[method]
    if method.apply?
      method.apply(console, args)
    else
      method(args)
  return args[0]

@_cout = =>
  console.log(arguments)  if console?
  arguments[0]

@deprecate = (subject, instead = null) =>
  @cout 'error', "`#{subject}` DEPRECATED!#{if instead then " Use instead `#{instead}`" else ''}"

@todo = (subject, location = null, numberOrString = null) =>
  if @LOG_TODO
    @cout 'warn', "TODO: #{subject}#{if location then " ### #{location}" else ''}#{if numberOrString then (if _.isNumber(numberOrString) then ":#{numberOrString}" else " > #{numberOrString}") else ''}"

@args = (a) ->
  @deprecate 'arg()', '_.toArray()'
  r = []
  Array::push.apply(r, a)  if a.length > 0
  r

@logicalXOR = (a, b) ->
  ( a and not b ) or ( not a and b )

@bound = (number, min, max) ->
  Math.max(min, Math.min(max, number))



@getParams = ->
  q = location.search.substring(1).split('&')
  r = {}
  for e in q
    t = e.split('=')
    r[t[0]] = t[1]
  r

@respondFormat = (url, format = null) ->
  aq = url.split('?')
  ah = aq[0].split('#')
  ad = ah[0].split('.')
  currentFormat = if ad.length > 1 and not /\//.test(ad[ad.length - 1]) then ad.pop() else ''
  return currentFormat  unless format?
  return url  if format is currentFormat
  ad.push format  if format<commit_msg>Use decodeURIComponent() in getParams() global helper<commit_after>###
 *  front-end js helpers
 *    0.3.3.alpha / 2010-2011
 *    <NAME> / Evrone.com
 *    koderfunk_at_gmail_dot_com
###

@DEBUG_MODE ?= false
@TEST_MODE ?= false
@LOG_TODO ?= true

@cout = =>
  args = _.toArray(arguments)
  method = if args[0] in ['log', 'info', 'warn', 'error', 'assert', 'clear'] then args.shift() else 'log'
  if @DEBUG_MODE and console?
    method = console[method]
    if method.apply?
      method.apply(console, args)
    else
      method(args)
  return args[0]

@_cout = =>
  console.log(arguments)  if console?
  arguments[0]

@deprecate = (subject, instead = null) =>
  @cout 'error', "`#{subject}` DEPRECATED!#{if instead then " Use instead `#{instead}`" else ''}"

@todo = (subject, location = null, numberOrString = null) =>
  if @LOG_TODO
    @cout 'warn', "TODO: #{subject}#{if location then " ### #{location}" else ''}#{if numberOrString then (if _.isNumber(numberOrString) then ":#{numberOrString}" else " > #{numberOrString}") else ''}"

@args = (a) ->
  @deprecate 'arg()', '_.toArray()'
  r = []
  Array::push.apply(r, a)  if a.length > 0
  r

@logicalXOR = (a, b) ->
  ( a and not b ) or ( not a and b )

@bound = (number, min, max) ->
  Math.max(min, Math.min(max, number))



@getParams = ->
  q = location.search.substring(1).split('&')
  r = {}
  for e in q
    t = e.split('=')
    r[decodeURIComponent(t[0])] = decodeURIComponent(t[1])
  r

@respondFormat = (url, format = null) ->
  aq = url.split('?')
  ah = aq[0].split('#')
  ad = ah[0].split('.')
  currentFormat = if ad.length > 1 and not /\//.test(ad[ad.length - 1]) then ad.pop() else ''
  return currentFormat  unless format?
  return url  if format is currentFormat
  ad.push format  if format
{'fraction_non_alphanumeric': 0.18818760856977418, 'fraction_numerical': 0.012738853503184714, 'mean_word_length': 3.4068877551020407, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 29, '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': '1078998', 'n_tokens_mistral': 1308, 'n_tokens_neox': 1301, 'n_words': 344}