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

fix: Do not use default parameter values for ie https://github.com/brix/crypto-js/pull/357 #374

Closed
wants to merge 2 commits into from

Conversation

spencer17x
Copy link
Contributor

We discussed this pr: https://github.com/brix/crypto-js/pull/357,and use this pr to fix it.

// Shortcuts
var words = wordArray.words;
var sigBytes = wordArray.sigBytes;
var map = urlSafe ? this._safe_map : this._map;
var map = urlSafe === undefined ? this._map : this._safe_map;

Choose a reason for hiding this comment

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

I think you want

var map = urlSafe === undefined || urlSafe ? this._safe_map : this._map;

If urlSafe is undefined, you want this to default to true, so you want to use the _safe_map scenario. Or perhaps I'm missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you use babel, you will find that the default value of the function parameter only needs to judge undefined.
image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

emmm...you are right, but i think maybe this way will be better?

var map = urlSafe ? this._safe_map : this._map;

@evanvosberg
Copy link
Member

Already solved, but not released yet.

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