Es un programa para parsear un fragmento de código.
npm install @alu0100901214/espree-logging-module- [Installation][1]
- [Executable][2]
- [Code][3]
- [Example][4]
- [Input][5]
- [Output][6]
- [addLogging][7]
- [Parameters][8]
- [Pattern][9]
- [Example][10]
- [Input][11]
- [Output][12]
```
npm install @alu0100901214/espree-logging-module --save
Executable usage:
`
Usage: logging-espree [options]
Es un programa para parsear un fragmento de código.
Options:
-V, --version output the version number
-o, --output
-p, --pattern
-h, --help display help for command
`
Code usage:
``
const addlogging = require('@alu0100901214/espree-logging-module/src/logging-espree');
``
npx addlogging input.js -o output.js
``
function foo(a, b, c) {
let x = 'tutu';
let y = (function (x) { return x*x })(2);
let z = (e => { return e +1 })(4);
}
foo(1, 'wut', 3);
`Entering foo(${ a },${ b },${ c }) at line 1
function foo(a, b, c) {
console.log();Entering
let x = 'tutu';
let y = function (x) {
console.log();Entering
return x * x;
}(2);
let z = (e => {
console.log();`
return e + 1;
})(4);
}
foo(1, 'wut', 3);
Add console.log in every Function.
- code [string][12] String with the code.
Returns [string][12] Return the string with the console.log inserted.
Pattern option:
You can use a regex pattern that allows you to locate the name of a function and add the console.log to it.
``
npx addlogging input.js -p fo* -o output.js
``
function foo(a, b, c) {
let x = 'tutu';
let y = (function (x) { return x*x })(2);
let z = (e => { return e +1 })(4);
}
foo(1, 'wut', 3);
`Entering foo(${ a },${ b },${ c }) at line 1
function foo(a, b, c) {
console.log();``
let x = 'tutu';
let y = function (x) {
return x * x;
}(2);
let z = (e => {
return e + 1;
})(4);
}
foo(1, 'wut', 3);
[1]: #Installation
[2]: #Executable
[3]: #Code
[4]: #Example
[5]: #Input
[6]: #Output
[7]: #addlogging
[8]: #parameters
[9]: #Pattern
[10]: #Example-1
[11]: #Input-1
[12]: #Output-1
[13]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
[14]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object