open-index/open-npm huggingface dataset:
npm package: @ggcristo/logging-input
Description: Este programa recibe otro programa en forma de string, el cual modifica añadiendole sentencias ```console.log``` cada vez que se aparece una función.
Author: Cristo Garćia González
Latest version: 0.4.2

[![CI for addLogging module](https://github.com/ULL-ESIT-PL-2021/espree-logging-module-GGCristo/actions/workflows/nodejs.yml/badge.svg)](https://github.com/ULL-ESIT-PL-2021/espree-logging-module-GGCristo/actions/workflows/nodejs.yml)\
addLogging
==========

Module to apply ``"printf() debugging"``, trought metaprograming every time you call a function

## Installation
```
npm install @ggcristo/logging-input -g
```

## Usage
```
add-logging --pattern foo --output salida.js input.js  
This read the "input.js" file search and in case the file has valid
javascript in it, search for the funtion whose identifier match with the one you write in the --pattern option, written a console.log on it.
```
Hipotetic file
```js
function foo(a, b) {
  var x = 'blah';
  var y = (function () {
    return 3;
  })();
}
foo(1, 'wut', 3);
```
Output
```js
function foo(a, b) {
    console.log(`Entering foo(${ a }, ${ b }) at line 1`);
    var x = 'blah';
    var y = function () {
        return 3;
    }();
}
foo(1, 'wut', 3);
```
Module Help
~~~
~: add-logging
~~~
~~~
Usage: add-logging [options] <filename> [...]

Metaprogramación con AST

Options:
  -V, --version               output the version number
  -o, --output <filename...>  fichero de salida
  -h --help                   output usage information
  -p --pattern <pattern>      filter the function to process
~~~
## API usage
This is an one-function module:
```
addLogging(code, functionNamePattern)
```
This function take the code in the form of a string (```code```), the ```functionNamePattern``` is opcional.\
It will return the result code in a form of a string as well.

## Tests
```
npm test
```
## Constributing

Try to use a consist style with the already existing code, avoid monster commits.\
If you consider the contribution is big, create a pr and add the tag [WIP] so 
others can watch over the process

## Release History

* 0.2.0 Initial release
* 0.2.1 Básic test(WIP)
* 0.2.2 Actions
* 0.2.3 Minor bug fixes
* 0.3.0 Executable file
* 0.4.0 Patter option
npm package: @ggcristo/login-input
Description: Este programa recibe otro programa en forma de string, el cual modifica añadiendole sentencias ```console.log``` cada vez que se aparece una función.
Author: Cristo Garćia González
Latest version: 0.1.0

[![CI for addLogging module](https://github.com/ULL-ESIT-PL-2021/espree-logging-module-GGCristo/actions/workflows/nodejs.yml/badge.svg)](https://github.com/ULL-ESIT-PL-2021/espree-logging-module-GGCristo/actions/workflows/nodejs.yml)\
addLogging
==========

Module to apply ``"printf() debugging"``, trought metaprograming every time you call a function

## Installation
```
npm install addLogging --save
```

## Usage
~~~js
function addLogging (code) {
  const ast = esprima.parse(code, { ecmaVersion: esprima.latestEcmaVersion, loc: true });
  estraverse.traverse(ast, {
    enter: function (node, parent) {
      if (node.type === 'FunctionDeclaration' ||
        node.type === 'FunctionExpression' ||
        node.type === 'ArrowFunctionExpression') {
        addBeforeCode(node);
      }
    }
  });
  return escodegen.generate(ast);
}

function addBeforeCode(node) {
  let param_name = [];
  node.params.forEach(function (i) { param_name.push("${ " + i.name + " }") });
  param_name = param_name.join(', ');
  let name = node.id ? node.id.name : '<anonymous function>';
  let beforeCode = `console.log(\`Entering ${name}(${param_name}) at line ${node.loc.start.line}\`);`;
  let beforeNodes = esprima.parse(beforeCode, { ecmaVersion: 6 }).body; // Is an Array of ASTs
  node.body.body = beforeNodes.concat(node.body.body);
}

console.log(addLoggin(<your-code-goes-here>));
~~~

## Tests
```
npm test
```
## Constributing

Try to use a consist style with the already existing code, avoid monster commits.\
If you consider the contribution to be big, create a pr and add the tag [WIP] so 
others can watch over the process

## Release History

* 0.1.0 Initial release

## Documentation

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

### Table of Contents

-   [addLogging][1]
    -   [Parameters][2]
-   [addBeforeCode][3]
    -   [Parameters][4]

## addLogging

Write a literal console.log() function with information
of the funcion itself

### Parameters

-   `code` **[string][5]** Code in string form

Returns **any** The result code in string form

## addBeforeCode

Transforms the node of interest

### Parameters

-   `node` **[node][6]** node of the AST with the type of
                         a function

[1]: #addlogging

[2]: #parameters

[3]: #addbeforecode

[4]: #parameters-1

[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String

[6]: https://developer.mozilla.org/docs/Web/API/Node/nextSibling