Getting Started
Installation
bash
yarn add dumpkit
# or
npm install dumpkitBasic Usage
Import what you need
js
import { dump, dd, inspect, trace, measure } from 'dumpkit';Dump a value
js
const user = { name: 'John', age: 30, tags: ['admin', 'user'] };
dump(user);Output:
{
name: "John",
age: 30,
tags: ["admin", "user"]
}Dump and die
js
dd(user); // Dumps the value and terminates the processGet formatted string without printing
js
const output = inspect(user);
console.log('Debug:', output);Trace execution flow
js
function authenticate() {
trace('auth-user');
// ... authentication logic
}
authenticate();Output:
[Trace] auth-user at src/auth.ts:42:12Measure performance
js
// Synchronous
measure('sort-array', () => {
return array.sort();
});
// Asynchronous
await measure('db-query', async () => {
return await database.find({ id: 1 });
});Output:
[Measure] sort-array: 2.35ms
[Measure] db-query: 45.23msNext Steps
- Check the API Reference for detailed options
- See Examples for advanced usage
- Read about the Philosophy behind dumpkit