FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

AbstractSetting: Add "formatter" parameter by Baitinq · Pull Request #470 · lambda-client/lambda-legacy · GitHub

This repository was archived by the owner on Dec 12, 2025. It is now read-only.

AbstractSetting: Add "formatter" parameter - #470

Open
Baitinq wants to merge 2 commits into
lambda-client:masterfrom
Baitinq:formatter
Open

AbstractSetting: Add "formatter" parameter #470
Baitinq wants to merge 2 commits into
lambda-client:masterfrom
Baitinq:formatter

Conversation

Baitinq commented Jan 20, 2023

Copy link
Copy Markdown
Contributor

This patch adds a new "formatter: (T) -> String" parameter to the
AbstractSetting abstract class. This allows for formatter functions to
be passed to settings for them to display their value in a more user
friendly way :)

A possible usage of this would be to replace the unit parameter, as it
simply concatenates the unit string to the setting value, which is a bit
misleading IMO.

P.S. This PR also includes an actual usage of this new parameter in the AntiDisconnect module

This patch adds a new "formatter: (T) -> String" parameter to the
AbstractSetting abstract class. This allows for formatter functions to
be passed to settings for them to display their value in a more user
friendly way :)

A possible usage of this would be to replace the unit parameter, as it
simply concatenates the unit string to the setting value, which is a bit
misleading IMO.
We now show "$x presses" by using the newly added setting formatter
Baitinq changed the title Formatter AbstractSetting: Add "formatter" variable Jan 20, 2023
Baitinq changed the title AbstractSetting: Add "formatter" variable AbstractSetting: Add "formatter" parameter Jan 20, 2023

Copy link
Copy Markdown
Member

this is very similar to the unit parameter which is only suffix. yours can be any format. so if you want you can add some default formattings like "x ticks" or "x blocks" and remove unit.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL