jalasem / templatestringparser

A package that helps you process template strings against values
https://www.npmjs.com/package/templatestringparser
MIT License
12 stars 4 forks source link

Separate Configuration code into a different function #4

Open Israel-Laguan opened 4 years ago

Israel-Laguan commented 4 years ago

Problem

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

https://github.com/jalasem/templatestringparser/blob/29fec424a86ee72110c7f98629989b15df8e9251/index.js#L19-L24

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 commented 4 years ago

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