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

Add a fromString() constructor. #9

Open
TheOneTheOnlyJJ opened this issue Nov 2, 2024 · 1 comment
Open

Add a fromString() constructor. #9

TheOneTheOnlyJJ opened this issue Nov 2, 2024 · 1 comment

Comments

@TheOneTheOnlyJJ
Copy link

While the current API provides a toString() method for serialization, it would also be handy to have a Measure.fromString() method for de-serialization.

Even though parsing such a string is trivial, it should still be handled internally by the API, with the possibility of throwing an Error on invalid or non-sensical inputs (think of temperatures below 0 Kelvin).

@TheOneTheOnlyJJ
Copy link
Author

Also, the precision should be (optionally?) serialized along the value and unit.

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

No branches or pull requests

1 participant