<commit_before># Implement require in the spirit of NodeJS.

require = (name) ->

	unless requires_[name]?
		throw new Error "Cannot find module '#{name}'"
	
	unless requires_[name].module?
		exports = {}
		module = exports: exports
		
		f = requires_[name]
		requires_[name] = module: module
		
		f.call null, module, exports, require
		
	requires_[name].module.exports

angular.module('shrub.require', []).provider 'require', ->
	require: require
	$get: -> require<commit_msg>require: check for index files in named directories<commit_after># Implement require in the spirit of NodeJS.

require = (name) ->

	key = name
	
	# Check for index file in named directory.
	key = "#{key}/index" unless requires_[key]?
		
	throw new Error "Cannot find module '#{name}'" unless requires_[key]?
	
	unless requires_[key].module?
		exports = {}
		module = exports: exports
		
		f = requires_[key]
		requires_[key] = module: module
		
		f.call null, module, exports, require
		
	requires_[key].module.exports

angular.module('shrub.require', []).provider 'require', ->
	require: require
	$get: -> require
{'fraction_non_alphanumeric': 0.12991765782250686, 'fraction_numerical': 0.0, 'mean_word_length': 4.018348623853211, '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': '3179078', 'n_tokens_mistral': 363, 'n_tokens_neox': 319, 'n_words': 107}