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

Should we not modify the settings of the default BigNumber instance? #727

Closed
overcat opened this issue Feb 4, 2024 · 0 comments · Fixed by #729
Closed

Should we not modify the settings of the default BigNumber instance? #727

overcat opened this issue Feb 4, 2024 · 0 comments · Fixed by #729
Labels

Comments

@overcat
Copy link
Contributor

overcat commented Feb 4, 2024

Describe the bug
See https://gist.github.com/Shaptic/5ce4f16d9cce7118f391fbde398c2f30?permalink_comment_id=4873892#gistcomment-4873892

What version are you on?
v10.0.2

To Reproduce
N/A

Expected behavior
Wouldn't it be better if we could not affect the settings of the default instance?

import {BigNumber} from "bignumber.js";

const SDKBigNumber = BigNumber.clone()
SDKBigNumber.DEBUG = true
try {
    new SDKBigNumber("invalid")
} catch (e) {
    console.log("error")
}

// This will not affect the settings of the default instance, so no exception here.
console.log(new BigNumber("invalid"))

Additional context
N/A

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

Successfully merging a pull request may close this issue.

2 participants
@overcat and others