7.1.0 ā€¢ Published 3 years ago

rx-debugger v7.1.0

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

rx-debugger

šŸ” Easily debug rxjs pipes

šŸ”— Docs

šŸ“¦ NPM

This package makes it super-easy to understand what goes down your pipes. Just type something like this:

import { rxDebugger, map, toArray } from 'rx-debugger';
import { of } from 'rxjs';

rxDebugger(of(1, 2, 3))
  .pipe(
    map((item) => item * 2),
    toArray()
  )
  .subscribe();

And you will get this straight in the console:

operatorvaluedate
(start)12021-10-21T14:20:55.510Z
map22021-10-21T14:20:55.510Z
(start)22021-10-21T14:20:55.510Z
map42021-10-21T14:20:55.510Z
(start)32021-10-21T14:20:55.510Z
map62021-10-21T14:20:55.510Z
toArray 2, 4, 6 2021-10-21T14:20:55.510Z
(complete)2021-10-21T14:20:55.510Z

Could it be easier than this?

šŸ”§ Configuration

rx-debugger offers more configuration other than printing the pipe as a table.

šŸ–Øļø Loggers

Loggers define how and where debug information will be printed.

There's no way to build custom loggers at the moment, but we plan to support this in the near future.

Loggers can be configured while patching the source observable.

For example:

rxDebugger(source, { logger: { type: LoggerType.REALTIME } });

Please refer to example-logger.ts.

Table logger (default ā­)

Gathers all the data, then prints them in a table (using console.table by default) as soon as the source errors or completes.

If you expect to use to work with mutable objects adopting a serializer is advised.

Real time logger

Prints data (using console.table by default) after each pipe operator does its job, without waiting observable complete or error.

This logger is advised when debugging long observables or subjects.

šŸ§¬ Serializers

Serializers help serializing/deserializing objects for printing purposes.

You can implement your own serializer implementing Serializer interface.

Loggers can be configured while patching the source observable.

For example:

rxDebugger(source, { serializer: { type: JsonSerializer });

Please refer to example-serializer.ts.

NoOp Serializer (default ā­)

As you may expect, this does nothing. By default no serialization is made.

JSON Serializer

Uses javascript bundled JSON serialization/deserialization.

ā„¹ļø Infos

  • This package is in early development stages. Any suggestion or help is welcome.
  • This package is intended for development use. You can use it in production environments at your own risk.
  • You can find more examples in example folder.

āš™ļø Compatibility

This package does not use semver for versioning. Our major number follows the one of rxjs. Here's the compatibility table.

rx-debuggerrxjs
^7.0.0^7.0.0
^6.0.0^6.0.0

šŸ’¬ FAQ

Q: I have undefined entries in my operator column.

A: All the operators should be imported from rx-debugger package.

Q: Nothing is printed.

A: Be sure to patch your source observable using rx-debugger function.

6.1.0

3 years ago

7.1.0

3 years ago

7.0.1

3 years ago

6.0.0

3 years ago

7.0.0

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.12

3 years ago

0.0.11

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 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