A lightweight utility for tracking property access chains, which can become whatever you want, useful for debugging and path tracing.
Open this link and copy the latest code into your debug console:
// Example context you need to debug
function blackBox(p) {
return p.a.b.c(1, 2).d[3][4];
}
// 1. Copy the code from https://cdn.jsdelivr.net/npm/@1ib/probe@latest/dist/index.umd.js and paste it here.
// ...
// 2. Inject the probe into the context you want to debug
blackBox(probe); // Logs: probe.a.b.c.(1, 2).d.3.4
# Using npm
npm install @1ib/probe
import Probe from '@1ib/probe';
const probe = new Probe({ callback: console.log });
probe.a.b.c(1, 2).d;
// Logs: ['a']
// Logs: ['a', 'b']
// Logs: ['a', 'b', 'c']
// Logs: ['a', 'b', 'c', [1, 2]]
// Logs: ['a', 'b', 'c', [1, 2], 'd']
Creates a new instance of the probe.
callback
: A function that is called with the current path array (default:console.info
)
- Debugging complex chained calls
- Tracing property access paths
- Building fluent APIs
- Inspecting object traversal
MIT