• Helper to transform given mutable instance into flat object. Properties with undefined values are not copied.

    Parameters

    • instance: any

      the instance to introspect.

    Returns Record<PropertyKey, any>

    values of all properties;

    const Clazz = declare({
    firstName: "",
    lastName: ""
    });
    const instance = new Clazz({firstName:"Test"});
    const state = toObject(instance);
    //-> { firstName: "Test", lastName:"" }