Skip to content
/ probe Public

A lightweight utility for tracking property access chains, which can become whatever you want, useful for debugging and path tracing.

License

Notifications You must be signed in to change notification settings

1ib/probe

Repository files navigation

@1ib/probe

A lightweight utility for tracking property access chains, which can become whatever you want, useful for debugging and path tracing.

Usage

1. Inject the probe code into your debug console

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

2. For project usage via npm

# 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']

API

new Probe(options?)

Creates a new instance of the probe.

Options

  • callback: A function that is called with the current path array (default: console.info)

Use Cases

  • Debugging complex chained calls
  • Tracing property access paths
  • Building fluent APIs
  • Inspecting object traversal

License

MIT

About

A lightweight utility for tracking property access chains, which can become whatever you want, useful for debugging and path tracing.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published