anthonykirby / lora-packet

LoRa radio packet decoder
MIT License
261 stars 83 forks source link

Added .toJSON() method to packet.js #37

Closed taraskuzyk closed 1 year ago

taraskuzyk commented 4 years ago

The method allows for easier extraction of data from the packet. It is based on the already existing .toString() method.

anthonykirby commented 4 years ago

I'll review - looks good, thanks!

anthonykirby commented 4 years ago

Hi taraskuzyk, I started writing a test for the new code, but it got me thinking. The function is called "toJSON" but it's not actually returning JSON, it's returning an object. This is a problem because we shouldn't create a function with a misleading name. Is your use case to actually have a JSON string, or is it to have a object that's easier to inspect?