0.0.6 • Published 2 years ago

kitchenlight v0.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago
npm i -D kitchenlight

Aliases

As long as the package is imported, aliases can be added to the console object. These include: console.tick, console.take, console.peek, console.watch! The counter for console is shared wherever it's used.

Apply it with: kitchenlight.applyToConsole();

To enable TypeScript support, add the following to your project's d.ts:

interface Console {
    tick: any,
    take: any,
    peek: any,
    watch: any,
}

Counter

To create a counter instance: const debugCounter = kitchenlight.counter("Debug_Counter");

By making counter instances, it is easier to share them across files and see what parts of your code are being reached.

Example:

const counter1 = kitchenlight.counter("counter1");
const counter2 = kitchenlight.counter("counter2");

counter1.tick("Incrementing the counter. This field is optional.");
counter2.tick();

counter1.take("Decrementing the counter. This field is optional.");

Result:

Watch

To watch a function, enter it in via const function = kitchenlight.watch(function, "Watching The Function");

This will create a wrapper and alert stdout on each invocation. Example:

function hello(arg) {
    console.log("Hello", arg);
}

hello = console.watch(hello, "Hello Function");

hello("World")

Result:

Peek

Peek allows a quick look at object and JSON strings. kitchenlight.peek(object);

Example:

let obj = {
    name: "John",
    age: 20,
    dog: {
        name: "Jimmy",
        age: 4
    }
}

kitchenlight.peek(obj);

Result:

0.0.6

2 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago