stevermeister / ngx-cookie-service

Angular (4.2+ ...12) service for cookies. Originally based on the `ng2-cookies` library.

Home Page:https://www.npmjs.com/package/ngx-cookie-service

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Refactor setCookie method to reduce complexity?

pavankjadda opened this issue · comments

Is your feature request related to a problem? Please describe

No

Describe the solution you'd like

@stevermeister should we refactor setCookie method and reduce complexity? At present it follows recursion to determine cookie options. I think we can refactor it and make it simple. I did this for react-cookie-service library which you can see here. Let me know your thoughts.

Describe alternatives you've considered

NA

Additional context

No response

@pavankjadda sorry, not sure what exactly do you want to refactor. could you elaborate on this, please?
do you mean remove polymorphism like in react-cookie-service? when the function has only one interface

do you mean remove polymorphism like in react-cookie-service? when the function has only one interface

Yes, the reason I say that is because we can simplify it without recursion and pass options directly instead of passing again. I think it's redundant to build options object and call it again. Thoughts?

Never mind, I think we can leave it as is for now.