sqids-javascript icon indicating copy to clipboard operation
sqids-javascript copied to clipboard

chore: QOL improvements

Open robhanlon22 opened this issue 1 year ago • 3 comments

  • Move default blocklist to its own file so class Sqids is visible upon opening
  • Export minAlphabetLength, minLengthLimit, and maxValue so they're available to downstream consumers
  • Enforce Required<SqidsOptions> type on defaultOptions

robhanlon22 avatar Dec 11 '23 17:12 robhanlon22

@robhanlon22 Thanks for the PR. Two questions for you:

  1. Shouldn't newly exported constants be screaming snake case since that's typically the convention for hardcoded values?
  2. I do like the blocklist moved to a separate file, it's cleaner. Did you check if building the package worked nicely with it being moved? For some reason last time I couldn't get it to package properly.

4kimov avatar Dec 12 '23 00:12 4kimov

  1. Shouldn't newly exported constants be screaming snake case since that's typically the convention for hardcoded values?

Sure, I can do that. I was following the convention of defaultOptions here, but I can change them. I'll also alias defaultOptions to DEFAULT_OPTIONS.

  1. I do like the blocklist moved to a separate file, it's cleaner. Did you check if building the package worked nicely with it being moved? For some reason last time I couldn't get it to package properly.

Sure, I'll try it out, and see if anything needs tweaking.

robhanlon22 avatar Dec 12 '23 17:12 robhanlon22

@robhanlon22 Cool, thank you.

Regarding naming convention, I always thought this approach was reasonable for JS: https://stackoverflow.com/a/49537197

4kimov avatar Dec 13 '23 15:12 4kimov