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

feat: add Å to SI accepted units #1442

Merged
merged 4 commits into from
Oct 22, 2024
Merged

Conversation

ytittes
Copy link
Contributor

@ytittes ytittes commented Oct 21, 2024

Description

Added Å as accepted mathjs unit, equivalent to angstrom

Motivation

Required for the correct interpretation of certain metadata, can be easily extended for other special character units.

Fixes:

Please provide a list of the fixes implemented by this PR

Changes:

  • Changed /src/common/utils.ts to allow for new unit.
  • added testing for convertToSI

Tests included

  • Included for each change/fix?
  • Passing? (Merge will not be approved unless this is checked)

Documentation

  • swagger documentation updated [required]
  • official documentation updated [nice-to-have]

official documentation info

If you have updated the official documentation, please provide PR # and URL of the pages where the updates are included

Copy link
Contributor

@sbliven sbliven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New tests look good!

You should run npm run lint:fix.

The PR title enforcement is kinda dumb imo, but you can change it to feat: add Å to SI accepted units to comply.

Unit.isValidAlpha = function (c) {
return isAlphaOriginal(c) || c == 'Å'
}
createUnit('Å', '1 angstrom')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works since mathjs is only imported in a single file. However if we need to handle units from multiple files then we should refactor this so that the module setup code only gets called once.

@ytittes ytittes changed the title Add Å to SI accepted units feat: add Å to SI accepted units Oct 21, 2024
@ytittes
Copy link
Contributor Author

ytittes commented Oct 21, 2024

I changed the title and ran the lint; everything should be in order now.

Copy link
Contributor

@Junjiequan Junjiequan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@Junjiequan
Copy link
Contributor

@sbliven The PR title validation is mainly for clean release notes. You can see the differences of the release notes here before and after PR title check job

@sbliven sbliven merged commit 30dc21e into SciCatProject:master Oct 22, 2024
8 checks passed
@sbliven sbliven mentioned this pull request Oct 23, 2024
4 tasks
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

Successfully merging this pull request may close these issues.

3 participants