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

StringUtils.fillIn vs PatternStringProperty #145

Closed
samreid opened this issue Mar 27, 2024 · 1 comment
Closed

StringUtils.fillIn vs PatternStringProperty #145

samreid opened this issue Mar 27, 2024 · 1 comment
Assignees

Comments

@samreid
Copy link
Member

samreid commented Mar 27, 2024

During code review #103 we saw that FieldMeterNode.ts, ACNumberControl and PercentControl are using StringUtils.fillIn whereas PatternStringProperty is used in PercentControl and DCPowerSupplyNode. Would it be better to use PatternStringProperty everywhere?

@pixelzoom
Copy link
Contributor

pixelzoom commented Mar 28, 2024

PatternStringProperty requires a TReadOnlyProperty<string> as its first argument.

FieldMeterNode: The pattern is not a Property, and I did not want to artificially create one for a static string. 9 PatternStringProperty instances per FieldMeter x 5 screens = 45 unnecessary PatternStringProperty instances. DerivedStringProperty is the better choices here.

ACNumberControl: PatternStringProperty is irrelevant here. The use of StringUtils.fillIn is in the numberFormatter option to a NumberDisplay.

PercentControl: PatternStringProperty is used were appropriate. The 1 use of StringUtils.fillIn is in the numberFormatter option to a NumberDisplay.

Reopen if I missed anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants