TwilioDevEd / message-segment-calculator

JS-based tool to calculate and display message segmentation data for a given message body
https://twiliodeved.github.io/message-segment-calculator/
MIT License
85 stars 35 forks source link

Create a library for the segment calculator #7

Closed vernig closed 3 years ago

vernig commented 3 years ago

The proposal is to create a JS library for the segment calculator functionality. This library can then be reused in scripts / serverless / webapp to provide information about encoding of a message. The idea is then to distribute the script through npm / CDN.

In addition to that, it would be nice to have the lib in different languages as well.

@HugoCrd has already a very good implementation of that at https://www.npmjs.com/package/@setkeeper/text-message-utils

HugoCrd commented 3 years ago

Hi! I'd be happy to help in that matter. Here's what I know from a JS perspective. When wrapping your tool within the library we pushed, I had to tweak some things to make it expose the right information. As these changes were squashed into my first commit, I just pushed a branch to better show what did change on our side.

https://github.com/Melusyn/text-message-utils/commit/e0a49654737fdeb8d2fdb2d33ee4f1ba904b9719

As you can see, these changes allows me to:

From my perspective these are the main changes that needed to be done, as well as adding a TypeScript layer and some test coverage.

Hope that helps, Hugo

vernig commented 3 years ago

Thanks @HugoCrd for sharing the details, this sounds great! I was also thinking to tweak the library slightly because I feel it's performing some unnecessary steps. I'll start working on it next week, and keep you posted.