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

#303 added equals method to currency object #310

Closed
wants to merge 1 commit into from

Conversation

overthemike
Copy link

Added a simple equals method to check for equality for either a number or another currency object. Added docs for new method.

#303

* @param {number|currency} foreign
* @returns {boolean}
*/
equals(foreign) {
Copy link

Choose a reason for hiding this comment

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

Drive-by comment: "foreign" has a specific connotation in dealing with currencies (e.g. "foreign exchange rate") which falsely implies that this may deal with currency conversions. Perhaps another variable name like other would be less ambiguous?

@@ -146,6 +146,21 @@ currency.prototype = {
return currency(intValue /= parse(number, _settings, false), _settings);
},

/**
* Compares value to another currency instance's value
Copy link

Choose a reason for hiding this comment

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

How should this handle amounts of different currencies? (e.g. comparing dollars to euros?)

@overthemike overthemike closed this Sep 1, 2024
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.

2 participants