Function debug_xd

  • This function allows you to attach extra data to any object for temporary debugging purposes. It essentially allows you to carry some data around that is tied to / associated with an object. It is especially useful for objects that make it difficult to hackishly modify custom properties in moments of debugging.

    Parameters

    • obj: any

    Returns any

    Example

    const john = create_person();
    debug_xd(john).name = "john";

    const jane = create_person();
    debug_xd(jane).name = "jane";

    // later on, we detect an error originating in some person object and we'd like to log its name
    const person = get_arbitrary_person();

    try {
    person.do_something();
    } catch(e) {
    console.log(debug_xd(person).name, "caused the error");
    }}

Generated using TypeDoc