<commit_before>/* eslint-disable no-redeclare */

/* This module provides access to objects that are scoped to the lifespan of a
 * request.
 *
 * Use `getNamespace` to retrieve a module-level object provider.
 *
 * Note that `getNamespace` _returns a function_.  It should be called at the
 * module level.  The function that's returned must be called _for each access_.
 *
 * Example:
 *
 *   var RequestLocals = require('triton').RequestLocalStorage.getNamespace();
 *
 *   var getInstance = function(){
 *
 *     // Get a reference to _current_ request's locals.
 *     var locals = RequestLocals();
 *
 *     if (!locals.instance)
 *       locals.instance = new Instance();
 *
 *     return locals.instance;
 *   }
 *
 */

if (SERVER_SIDE){
	var key          = '_triton_request_local_storage_'
	,   cls          = require('continuation-local-storage').createNamespace(key)
	,   bind         = cls.bind.bind(cls)
	,   getContainer = () => cls.get(key)
	,   startRequest = (start) => { cls.run(() => {cls.set(key, []); start()}) }<commit_msg>Update commentary in RequestLocalStorage to match convention<commit_after>/* eslint-disable no-redeclare */

/* This module provides access to objects that are scoped to the lifespan of a
 * request.
 *
 * Use `getNamespace` to retrieve a module-level object provider.
 *
 * Note that `getNamespace` _returns a function_.  It should be called at the
 * module level.  The function that's returned must be called _for each access_.
 *
 * Example:
 *
 *   var RLS = require('triton').RequestLocalStorage.getNamespace();
 *
 *   var getInstance = function(){
 *
 *     // Get a reference to _current_ request's locals.
 *     var locals = RLS();
 *
 *     if (!locals.instance)
 *       locals.instance = new Instance();
 *
 *     return locals.instance;
 *   }
 *
 */

if (SERVER_SIDE){
	var key          = '_triton_request_local_storage_'
	,   cls          = require('continuation-local-storage').createNamespace(key)
	,   bind         = cls.bind.bind(cls)
	,   getContainer = () => cls.get(key)
	,   startRequest = (start) => { cls.run(() => {cls.set(key, []); start()}) }
{'fraction_non_alphanumeric': 0.13131790269248939, 'fraction_numerical': 0.0, 'mean_word_length': 3.049713193116635, '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': '5694420', 'n_tokens_mistral': 646, 'n_tokens_neox': 642, 'n_words': 186}