<commit_before>// Log when scope() is called and when code actually runs
// Implementation of scopeornot API
// https://github.com/eric-brechemier/scopeornot

// This is a filter which must be loaded after another implementation,
// for example scope-bootstrap.js, scope-private.js and scope-ready.js

/*global scope*/
scope(function(parentContext){

  var
    // declare aliases
    parentScope = parentContext.scope,
    Date = parentContext.Date,
    Number = parentContext.Number,
    console = parentContext.console || {},
    log = console.log || function(){};

  /*
    Function: getTimeStamp(): number
    Get a time stamp

    Returns:
      number, the number of milliseconds since 1970-01-01T00:00Z.
  */
  function getTimeStamp(){
    return Number(new Date());
  }

  /*
    Function: scope(code[,needs[,name]])
    Filter to log the call to scope() and when the code runs

    Parameters:
      code  - function(context), the code to run with the context as parameter
      needs - optional, array of strings, the names of the properties that
              this code would like to find in the context
      name  - optional, string, name of the context property to set the value
              that the code may return

    Note:
    Nothing happens in case console.log() is not available. The "console" is
    requested in the context at the time when scope() is called to define this
    implementation. A custom "console" may be defined beforehand, for example
    to forward the logs to a remote server.
  */
  function scope(code,needs,name){
    log.call(console,getTimeStamp(),":","scope(",code,",",needs,",",name,")");
    parentScope(function(context){
      log.call(console,getTimeStamp(),":","code(",code,",",needs,",",name,")");
      return code(context);
    },needs,name);
  }

  return scope;

},["scope","console","Date","Number"],"scope");<commit_msg>Return the parent value in scope-log<commit_after>// Log when scope() is called and when code actually runs
// Implementation of scopeornot API
// https://github.com/eric-brechemier/scopeornot

// This is a filter which must be loaded after another implementation,
// for example scope-bootstrap.js, scope-private.js and scope-ready.js

/*global scope*/
scope(function(parentContext){

  var
    // declare aliases
    parentScope = parentContext.scope,
    Date = parentContext.Date,
    Number = parentContext.Number,
    console = parentContext.console || {},
    log = console.log || function(){};

  /*
    Function: getTimeStamp(): number
    Get a time stamp

    Returns:
      number, the number of milliseconds since 1970-01-01T00:00Z.
  */
  function getTimeStamp(){
    return Number(new Date());
  }

  /*
    Function: scope(code[,needs[,name]]): any
    Filter to log the call to scope() and when the code runs

    Parameters:
      code  - function(context), the code to run with the context as parameter
      needs - optional, array of strings, the names of the properties that
              this code would like to find in the context
      name  - optional, string, name of the context property to set the value
              that the code may return

    Returns:
      any, the return value of this code if it has run synchronously,
      or null if the code has not run yet

    Note:
    Nothing happens in case console.log() is not available. The "console" is
    requested in the context at the time when scope() is called to define this
    implementation. A custom "console" may be defined beforehand, for example
    to forward the logs to a remote server.
  */
  function scope(code,needs,name){
    log.call(console,getTimeStamp(),":","scope(",code,",",needs,",",name,")");
    return parentScope(function(context){
      log.call(console,getTimeStamp(),":","code(",code,",",needs,",",name,")");
      return code(context);
    },needs,name);
  }

  return scope;

},["scope","console","Date","Number"],"scope");
{'fraction_non_alphanumeric': 0.11688311688311688, 'fraction_numerical': 0.006111535523300229, 'mean_word_length': 3.2695652173913046, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '1489593', 'n_tokens_mistral': 1110, 'n_tokens_neox': 1063, 'n_words': 404}