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

Avoid polluting BigNumber prototype #27

Open
roccomuso opened this issue Apr 2, 2021 · 0 comments
Open

Avoid polluting BigNumber prototype #27

roccomuso opened this issue Apr 2, 2021 · 0 comments

Comments

@roccomuso
Copy link

Since it's used only in 1 place, this can be avoided:

BigNumber.prototype.pad = function(size) {
var s = String(this);
while (s.length < (size || 2)) {s = "0" + s;}
return s;
};

and replaced using lodash padStart(x, 2, '0').
Not a good practice to pollute prototype for libs being reused elsewhere in a project.

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

2 participants
@roccomuso and others