Skip to content

feat(concerto-util): add MonetaryUtil support - #1102

Merged
mttrbrts merged 1 commit into
accordproject:mainfrom
rockaxorb13:feat/add-monetary-js
Mar 1, 2026
Merged

mttrbrts merged 1 commit into
accordproject:mainfrom
rockaxorb13:feat/add-monetary-js

Conversation

@rockaxorb13

Copy link
Copy Markdown
Contributor

Description

This PR adds a new MonetaryUtil class to the @accordproject/concerto-util package. This utility provides functionality to convert numbers into their written word representation (e.g., converting 100 to "one hundred"), utilizing the n2words library.

Motivation

As discussed in the previous meeting, there is a need for monetary text conversion support within the library to facilitate the upcoming implementation of the Monetary type in the core model. This utility lays the groundwork for that feature.

Changes

  • New File: Added lib/monetary.js containing the MonetaryUtil class.
  • Dependencies: Added n2words to package.json.
  • Exports: Exposed MonetaryUtil via index.js for external consumption.

Verification

  • Validated that the new utility correctly converts numbers to text strings using the default locale ('en').
  • Confirmed the package installs and exports the new class correctly.

Next Steps

Once merged, this utility will be used by the concerto-core logic to handle monetary serialization and human-readable formatting.

Comment thread packages/concerto-util/package.json Outdated
"dependencies": {
"@supercharge/promise-pool": "1.7.0",
"debug": "4.3.7",
"n2words": "^3.0.0",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please use a pinned/exact package version to prevent supply chain attacks.

@dselman dselman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM - just one small change required for the dependency on n2words. Can you also check that this webpacks ok and the increase in the bundle size?

@rockaxorb13

Copy link
Copy Markdown
Contributor Author

Fixed! I've pinned the n2words dependency to version 3.0.0.

I also ran the build locally to verify the bundle size:
Build Status: ✅ Webpack compiled successfully.
Bundle Size: 140 KiB (minimized).

Ready for review!

@dselman

dselman commented Jan 7, 2026

Copy link
Copy Markdown
Contributor

Please address the build failures.

@rockaxorb13

Copy link
Copy Markdown
Contributor Author

@dselman Done! Ready for review

@github-actions

Copy link
Copy Markdown
Contributor

This PR is stale because it has been open 15 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions Bot added the Stale label Jan 23, 2026
@github-actions github-actions Bot closed this Feb 2, 2026
@rockaxorb13

Copy link
Copy Markdown
Contributor Author

Commenting to reopen

@dselman dselman reopened this Feb 3, 2026

@dselman dselman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, thanks!

@dselman

dselman commented Feb 3, 2026

Copy link
Copy Markdown
Contributor

Please resolve merge errors and I will commit.

@github-actions github-actions Bot removed the Stale label Feb 4, 2026
Signed-off-by: Aadityavardhan Singh <singhrashmi018@gmail.com>
@rockaxorb13

Copy link
Copy Markdown
Contributor Author

@dselman done! Ready for review.

@github-actions

Copy link
Copy Markdown
Contributor

This PR is stale because it has been open 15 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions Bot added the Stale label Feb 22, 2026
@rockaxorb13

rockaxorb13 commented Feb 22, 2026 via email

Copy link
Copy Markdown
Contributor Author

@github-actions github-actions Bot removed the Stale label Feb 23, 2026
@mttrbrts
mttrbrts merged commit d5fe9f8 into accordproject:main Mar 1, 2026
13 checks passed
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