<commit_before>class exports.Router
	_scopedAction: null
	_scopedPrefix: ''

	constructor: (@app) ->

	group: (action, callback) ->
		@_scopedAction = Object.assign { }, action

		if @_scopedAction.prefix
			@_scopedPrefix = @_scopedAction.prefix
			delete @_scopedAction.prefix
		else
			@_scopedPrefix = ''

		callback()

		@_scopedAction = null
		@_scopedPrefix = ''

	all: (path, action) ->
		return @app.all @_scopedPrefix + path, @_makeAction(action)

	get: (path, action) ->
		return @app.get @_scopedPrefix + path, @_makeAction(action)

	post: (path, action) ->
		return @app.post @_scopedPrefix + path, @_makeAction(action)

	put: (path, action) ->
		return @app.put @_scopedPrefix + path, @_makeAction(action)

	delete: (path, action) ->
		return @app.delete @_scopedPrefix + path, @_makeAction(action)

	_makeAction: (action) ->
		if typeof action is 'function'
			return action
		else<commit_msg>Updated router to support setting an extra object on Route<commit_after>class exports.Router
	_scopedAction: null
	_scopedPrefix: ''

	constructor: (@app) ->

	group: (action, callback) ->
		@_scopedAction = Object.assign { }, action

		if @_scopedAction.prefix
			@_scopedPrefix = @_scopedAction.prefix
			delete @_scopedAction.prefix
		else
			@_scopedPrefix = ''

		callback()

		@_scopedAction = null
		@_scopedPrefix = ''

	all: (all, action) ->
		console.log 'Don’t use `all` routes. Offender: %s', path
		return @app.all @_scopedPrefix + path, @_makeAction(action)

	get: (path, action, extra) ->
		return @_add 'get', path, action, extra

	post: (path, action, extra) ->
		return @_add 'post', path, action, extra

	put: (path, action, extra) ->
		return @_add 'put', path, action, extra

	delete: (path, action, extra) ->
		return @_add 'delete', path, action, extra

	_add: (method, path, action, extra) ->
		action = @_makeAction action

		# WARNING: Prone to failure if ExpressJS changes this logic

		@app.lazyrouter()
		route = @app._router.route @_scopedPrefix + path
		route = route[method].apply route, [ action ]
		route.extra = extra or {}

		return route

	_makeAction: (action) ->
		if typeof action is 'function'
			return action
		else
{'fraction_non_alphanumeric': 0.13157894736842105, 'fraction_numerical': 0.0, 'mean_word_length': 3.970183486238532, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 20, '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': '7012484', 'n_tokens_mistral': 807, 'n_tokens_neox': 731, 'n_words': 205}