Skip to content

Conversation

@YoniKiriaty
Copy link
Contributor

This package is meant to compact data into a small string for small QR codes

@YoniKiriaty YoniKiriaty self-assigned this Dec 3, 2025
Copy link

@karnishein karnishein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea how you expect me to do this well

@YoniKiriaty YoniKiriaty added the new-package A PR to add a new custom package label Dec 4, 2025
Comment on lines 22 to 23
const binaryTrueValue = 1;
const binaryModulus = 2;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avoid using magic numbers. move to a consts file


const binaryTrueValue = 1;
const binaryModulus = 2;
// TODO add signed support!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

document this somewhere else then the code

@@ -0,0 +1,62 @@
// בס"ד

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sure you actually need this file. is there a built-in type or an NPM package you can use instead

Comment on lines +8 to +10
export const bitArrayLength = 8;
const singleShift = 1;
const shouldntInsert = 0;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more magic numbers

Comment on lines +8 to +10
export const bitArrayLength = 8;
const singleShift = 1;
const shouldntInsert = 0;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the name is for a boolean and the value is a number.

// TODO add signed support!
export const serdeUnsignedInt = (bitCount: number): Serde<number> => ({
serializer(serialiedData: BitArray, num: number) {
const arr = new BitArray();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avoid using abbreviations. arr --> array and num --> number

@@ -0,0 +1,264 @@
// בס"ד

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • extract every serialize and deserialize function to it's own function.
  • add a unit test for every function (Optional for this PR can be in another task)
  • split every de/serialize function to it's own file by the serialization type.
  • create a Factory/Builder function to get the desired Serde when used.
  • add a Readme.md file explaining what a Serde is (GPT is great for this)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-package A PR to add a new custom package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants