search
HomeWeb Front-endJS TutorialJsTraceToIX - Debugging React, Vue, and Node.js just got easier! – no need to clutter your codebase with `console.log`!

JsTraceToIX - Debugging React, Vue, and Node.js just got easier! – no need to clutter your codebase with `console.log`!

If you've ever had to debug React or Vue components, arrow functions, or complex expressions on Node or the Web Browser, you know the pain of adding multiple console.log statements and making unnecessary code changes. That's where JsTraceToIX comes in!

Project Link

Key Features:

  • Simplifies debugging with minimal code changes.
  • Supports debugging of React, Vue, and Node.js environments, as well as regular browsers.
  • Handles single-line expressions and arrow functions with ease.
  • Easily define names, filter results, and override inputs and outputs for better traceability.
  • Simple function names, like c__ and d__, make it easy to spot and remove traces after catching the bug.
  • Works seamlessly with multithreaded environments.

Bonus: If you're working with Python, check out PyTraceToIX, which offers the same powerful debugging tools for your Python projects.

Say goodbye to complex and messy debugging – with JsTraceToIX, you can capture inputs and display results all in one step, making debugging cleaner and faster!

Check out JsTraceToIX and see how it can simplify your debugging process.

Installation

Environment Require Installation
Browser No
Node.js Yes
React Optional
Vue Yes
npm install jstracetoix --save-dev

React Usage

In this example:

  • cityTax arrow function captures the input price and names it 'Price'.
  • On ShoppingList function:
    • c__ captures the title in the first .
    • c__ captures the output of the cityTax and names it CityTax in the 2nd .
    • d__ displays the aggregated information in a single line: title, price, cityTax, total Price.
    • The d__ will generate this output:

      i0:`Rice` | Price:`10` | CityTax:`5` | _:`15`
      i0:`Coffee` | Price:`30` | CityTax:`15` | _:`45`
      i0:`Shoes` | Price:`100` | CityTax:`15` | _:`115`
      
      import './App.css';
      // Without local installation
      import { c__, d__ } from 'https://cdn.jsdelivr.net/gh/a-bentofreire/jstracetoix@1.1.0/component/jstracetoix.mjs';
      
      // If it's installed locally via "npm install jstracetoix --save-dev"
      // import { c__, d__ } from 'jstracetoix/component/jstracetoix.mjs';
      
      const cityTax = (price) => c__(price, {name: 'Price'}) > 20 ? 15 : 5;
      const products = [
          { title: 'Rice', price: 10, id: 1 },
          { title: 'Coffee', price: 30, id: 2 },
          { title: 'Shoes', price: 100, id: 3 },
      ];
      
      function ShoppingList() {
          const listItems = products.map(product =>
              <tr key="{product.id}">
                  <td>{c__(product.title)}</td>
                  <td>{d__(product.price + c__(cityTax(product.price), { name: 'CityTax' }))}</td>
              </tr>
          );
      
          return (
              
      {listItems}
      ); } function App() { return (
      ); } export default App;

      Node.js Usage

      In this example:

      • c__.allow() - overrides the input value being debugged when value > 40.00, for other values it doesn't captures the input.
      • d__.allow() - overrides the result value being debugged.
      • d__.after() - stops the program after displaying the result and the captured fields.
      import { c__, d__ } from 'jstracetoix';
      
      const products = [
          { "name": "Smartphone 128GB", "price": 699.00 },
          { "name": "Coffee Maker", "price": 49.99 },
          { "name": "Electric Toothbrush", "price": 39.95 },
          { "name": "4K Ultra HD TV", "price": 999.99 },
          { "name": "Gaming Laptop", "price": 1299.00 }];
      
      const factor = (price) => price  c__(product.price,
          {
              allow: (index, name, value) => value > 40.00 ?
                  Math.floor(value * factor(value)) : false,
              name: product.name.substring(0, 10)
          })), {
          allow: (data) => data._.map((v, i) => `${i}:${v}`),
          after: (data) => process.exit() // exits after displaying the results
      });
      // Smartphone:`768` | Coffee Mak:`54` | 4K Ultra H:`1099` | Gaming Lap:`1299` | _:`["0:699","1:49.99","2:39.95","3:999.99","4:1299"]`
      
      // this code is unreachable
      for (const price in prices) {
          let value = price;
      }
      

      Output

      Environment Default Output Function
      Browser console.debug
      Node.js process.stdout
      React console.debug
      Vue console.debug

      Except for Node.js environment, the output is displayed in the browser's developer tools under the "Console Tab".
      Since the output is generated using console.debug, it can easily be filtered out from regular console.log messages.

      The default output function can be override using init__({'stream': new_stream.log })

      Metadata

      The d__ function callbacks allow, before and after will receive a parameter data with the allowed inputs plus the following meta items:

      • meta__: list of meta keys including the name key.
      • thread_id__: thread_id being executed
      • allow_input_count__: total number of inputs that are allowed.
      • input_count__: total number of inputs being captured.
      • allow__: If false it was allowed. Use this for after callback.
      • output__: Text passed to before without new_line.
      • name: name parameter

      Documentation

      Package Documentation

The above is the detailed content of JsTraceToIX - Debugging React, Vue, and Node.js just got easier! – no need to clutter your codebase with `console.log`!. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Javascript Data Types : Is there any difference between Browser and NodeJs?Javascript Data Types : Is there any difference between Browser and NodeJs?May 14, 2025 am 12:15 AM

JavaScript core data types are consistent in browsers and Node.js, but are handled differently from the extra types. 1) The global object is window in the browser and global in Node.js. 2) Node.js' unique Buffer object, used to process binary data. 3) There are also differences in performance and time processing, and the code needs to be adjusted according to the environment.

JavaScript Comments: A Guide to Using // and /* */JavaScript Comments: A Guide to Using // and /* */May 13, 2025 pm 03:49 PM

JavaScriptusestwotypesofcomments:single-line(//)andmulti-line(//).1)Use//forquicknotesorsingle-lineexplanations.2)Use//forlongerexplanationsorcommentingoutblocksofcode.Commentsshouldexplainthe'why',notthe'what',andbeplacedabovetherelevantcodeforclari

Python vs. JavaScript: A Comparative Analysis for DevelopersPython vs. JavaScript: A Comparative Analysis for DevelopersMay 09, 2025 am 12:22 AM

The main difference between Python and JavaScript is the type system and application scenarios. 1. Python uses dynamic types, suitable for scientific computing and data analysis. 2. JavaScript adopts weak types and is widely used in front-end and full-stack development. The two have their own advantages in asynchronous programming and performance optimization, and should be decided according to project requirements when choosing.

Python vs. JavaScript: Choosing the Right Tool for the JobPython vs. JavaScript: Choosing the Right Tool for the JobMay 08, 2025 am 12:10 AM

Whether to choose Python or JavaScript depends on the project type: 1) Choose Python for data science and automation tasks; 2) Choose JavaScript for front-end and full-stack development. Python is favored for its powerful library in data processing and automation, while JavaScript is indispensable for its advantages in web interaction and full-stack development.

Python and JavaScript: Understanding the Strengths of EachPython and JavaScript: Understanding the Strengths of EachMay 06, 2025 am 12:15 AM

Python and JavaScript each have their own advantages, and the choice depends on project needs and personal preferences. 1. Python is easy to learn, with concise syntax, suitable for data science and back-end development, but has a slow execution speed. 2. JavaScript is everywhere in front-end development and has strong asynchronous programming capabilities. Node.js makes it suitable for full-stack development, but the syntax may be complex and error-prone.

JavaScript's Core: Is It Built on C or C  ?JavaScript's Core: Is It Built on C or C ?May 05, 2025 am 12:07 AM

JavaScriptisnotbuiltonCorC ;it'saninterpretedlanguagethatrunsonenginesoftenwritteninC .1)JavaScriptwasdesignedasalightweight,interpretedlanguageforwebbrowsers.2)EnginesevolvedfromsimpleinterpreterstoJITcompilers,typicallyinC ,improvingperformance.

JavaScript Applications: From Front-End to Back-EndJavaScript Applications: From Front-End to Back-EndMay 04, 2025 am 12:12 AM

JavaScript can be used for front-end and back-end development. The front-end enhances the user experience through DOM operations, and the back-end handles server tasks through Node.js. 1. Front-end example: Change the content of the web page text. 2. Backend example: Create a Node.js server.

Python vs. JavaScript: Which Language Should You Learn?Python vs. JavaScript: Which Language Should You Learn?May 03, 2025 am 12:10 AM

Choosing Python or JavaScript should be based on career development, learning curve and ecosystem: 1) Career development: Python is suitable for data science and back-end development, while JavaScript is suitable for front-end and full-stack development. 2) Learning curve: Python syntax is concise and suitable for beginners; JavaScript syntax is flexible. 3) Ecosystem: Python has rich scientific computing libraries, and JavaScript has a powerful front-end framework.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment