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 ability to set default parameters on initial class creation #35

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

Comments

@M-Scott-Lassiter
Copy link
Owner

Contact Details

No response

Description

Right now, a new copy of the class has to be instantiated and then the parameters manually set. For example:

// Import into a project
const AlphanumericEncoder = require('alphanumeric-encoder')

const encoder = new AlphanumericEncoder()
encoder.allowLowerCaseDictionary = true
encoder.dictionary = 'abcdEFGH'

I would like the ability to simplify this by allowing the user to pass a configuration object like this:

// Import into a project
const AlphanumericEncoder = require('alphanumeric-encoder')

const encoder = new AlphanumericEncoder({allowLowerCaseDictionary: true, dictionary: "abcdEFGH"})

Both of these should be optional parameters with either one or the other passed. When processing, the allowLowerCaseDictionary term should be checked first followed by setting the dictionary.

Associated tests need to be added as well to keep coverage at 100%.

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 May 2, 2022
@M-Scott-Lassiter M-Scott-Lassiter self-assigned this May 2, 2022
github-actions bot pushed a commit that referenced this issue May 2, 2022
## [1.4.0](v1.3.0...v1.4.0) (2022-05-02)

### 🎁 Feature Changes

* add ability to instantiate the class using an optional config object in the constructor ([8dc230b](8dc230b)), closes [#35](#35)

### 🎯 Test Changes

* add tests verifying the optional config object works as expected ([f7f7de6](f7f7de6)), closes [#35](#35)
@M-Scott-Lassiter
Copy link
Owner Author

🎉 This issue has been resolved in version 1.4.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