Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]: Add the ability to use lower case letters in the dictionary #31

Closed
1 task done
M-Scott-Lassiter opened this issue Apr 30, 2022 · 1 comment
Closed
1 task done
Assignees
Labels
enhancement New feature or request released

Comments

@M-Scott-Lassiter
Copy link
Owner

M-Scott-Lassiter commented Apr 30, 2022

Contact Details

No response

Description

Right now, the dictionary doesn't allow lower case letters.

const AlphanumericEncoder = require('alphanumeric-encoder')

const encoder = new AlphanumericEncoder()

encoder.dictionary = 'abcd'
console.log(encoder.dictionary) // 'ABCD'

console.log(encoder.decode('D')) // 4
console.log(encoder.decode('d')) // undefined

I would like the ability to specify that lower case letters are in fact allowed. This is going to involve adding a new property: allowLowerCaseDictionary. The property should be

  • a getter/setter combo
  • false by default (avoids breaking compatibility and checks with most standard use cases)
  • referenced in the dictionary setter
  • documented with JSDoc
  • have associated tests to keep coverage at 100%

The decode script as it is now should work appropriately.

The final expected behavior is this

const AlphanumericEncoder = require('alphanumeric-encoder')

const encoder = new AlphanumericEncoder()

encoder.allowLowerCaseDictionary = true
encoder.dictionary = 'ABCDabcd'
console.log(encoder.dictionary) // 'ABCDabcd'

console.log(encoder.encode(6)) // 'b'
console.log(encoder.encode(15)) // 'Ac'
console.log(encoder.decode('D')) // 4
console.log(encoder.decode('AA')) // 9

Are you able/willing to make the change? (It's ok if you're not!)

Yes

Code of Conduct

@M-Scott-Lassiter M-Scott-Lassiter added the enhancement New feature or request label Apr 30, 2022
@M-Scott-Lassiter M-Scott-Lassiter self-assigned this Apr 30, 2022
github-actions bot pushed a commit that referenced this issue May 1, 2022
## [1.3.0](v1.2.0...v1.3.0) (2022-05-01)

### 🎁 Feature Changes

* add ability to use lower case letters in the dictionary ([a1b7066](a1b7066)), closes [#31](#31)

### 🏗️ Build Changes

* add @types/jest for type checking support in the testing suite ([56ff52d](56ff52d))
@M-Scott-Lassiter
Copy link
Owner Author

🎉 This issue has been resolved in version 1.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
None yet
Development

No branches or pull requests

1 participant