<commit_before>qs           = require 'qs'
map          = require 'lodash/map'
last         = require 'lodash/last'
omit         = require 'lodash/omit'
pick         = require 'lodash/pick'
partial      = require 'lodash/partial'
merge        = require 'lodash/merge'
remove       = require 'lodash/remove'
extend       = require 'lodash/extend'
memoize      = require 'lodash/memoize'
compact      = require 'lodash/compact'
isEmpty      = require 'lodash/isEmpty'
forEach      = require 'lodash/forEach'
cloneDeep    = require 'lodash/cloneDeep'
pathToRegexp = require 'path-to-regexp'
matchPattern = require('react-router/matchPattern').default

class OXRouter

  constructor: (routes) ->
    {routeSettings, renderers} = OXRouter.separateRendersFromRoutes(routes)
    mappedRoutes = mapRoutes(routeSettings)

    @getRenderers = -> renderers
    @getRoutes = -> routeSettings
    @getRoutesMap = -> mappedRoutes

  currentMatch: (path = window.location.pathname) =>
    cloneDeep(findRoutePatternMemoed(path, @getRoutesMap()))

  currentQuery: (options = {}) ->
    qs.parse((options.window or window).location.search.slice(1))

  currentParams: (options = {}) =>
    @currentMatch( (options.window or window).location.pathname)?.params or {}
<commit_msg>work around react-router bug with params<commit_after>qs           = require 'qs'
map          = require 'lodash/map'
last         = require 'lodash/last'
omit         = require 'lodash/omit'
pick         = require 'lodash/pick'
partial      = require 'lodash/partial'
merge        = require 'lodash/merge'
remove       = require 'lodash/remove'
extend       = require 'lodash/extend'
memoize      = require 'lodash/memoize'
compact      = require 'lodash/compact'
isEmpty      = require 'lodash/isEmpty'
forEach      = require 'lodash/forEach'
mapValues    = require 'lodash/mapValues'
cloneDeep    = require 'lodash/cloneDeep'
pathToRegexp = require 'path-to-regexp'
matchPattern = require('react-router/matchPattern').default

class OXRouter

  constructor: (routes) ->
    {routeSettings, renderers} = OXRouter.separateRendersFromRoutes(routes)
    mappedRoutes = mapRoutes(routeSettings)

    @getRenderers = -> renderers
    @getRoutes = -> routeSettings
    @getRoutesMap = -> mappedRoutes

  currentMatch: (path = window.location.pathname) =>
    cloneDeep(findRoutePatternMemoed(path, @getRoutesMap()))

  currentQuery: (options = {}) ->
    qs.parse((options.window or window).location.search.slice(1))

  currentParams: (options = {}) =>
    # needed until https://github.com/ReactTraining/react-router/pull/4064 is released
    params = @currentMatch( (options.window or window).location.pathname)?.params or {}
    mapValues(params, (value) -> if value is "undefined" then undefined else value )


{'fraction_non_alphanumeric': 0.11953773925604912, 'fraction_numerical': 0.0021668472372697724, 'mean_word_length': 3.4605475040257647, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 18, 'https://': 1, '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': '7369468', 'n_tokens_mistral': 870, 'n_tokens_neox': 835, 'n_words': 182}