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

Separate Configuration code into a different function #4

Open
Israel-Laguan opened this issue Jan 7, 2020 · 1 comment · May be fixed by #9
Open

Separate Configuration code into a different function #4

Israel-Laguan opened this issue Jan 7, 2020 · 1 comment · May be fixed by #9
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@Israel-Laguan
Copy link

Israel-Laguan commented Jan 7, 2020

Problem

This kind of code is adequate for separate into another function:

const {openingbracket, closingbracket, trim} = config
// setting default settings where config key is missing
var obk = (openingbracket) ? openingbracket : settings().openingbracket
var cbk = (closingbracket) ? closingbracket : settings().closingbracket
var trm = (trim !== undefined && trim) ? trim : settings().trim

If the current way to manage configuration logic if the options grow in number the code would be larger and you are on risk of breaking the Single Responsibility Principle. Also it makes less obvious the purpose of the function.

Proposal

Make configuration lines move to another function. The logic can be in settings function but I suggest a new function instead.

@tunjioye
Copy link
Contributor

tunjioye commented Jan 7, 2020

WOW, This is a brilliant observation. We will definitely implement this Proposal soon.

@jalasem jalasem added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Feb 7, 2024
@mihrab34 mihrab34 linked a pull request Feb 21, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants