Skip to content

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

Closed
spencer17x wants to merge 2 commits intobrix:developfrom
spencer17x:develop
Closed

fix: Do not use default parameter values for ie https://github.com/brix/crypto-js/pull/357#374
spencer17x wants to merge 2 commits intobrix:developfrom
spencer17x:develop

Conversation

@spencer17x
Copy link
Contributor

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

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