Skip to content

Commit

Permalink
Use non-arrow-function for export (#18)
Browse files Browse the repository at this point in the history
* Use non-arrow-function for export

* Explicitly set arguments[0]

In strict mode, the elements in `arguments` are not the same ref as the actual arguments used in the function, editing one won't change the other.

[Useful MDN link](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode#Making_eval_and_arguments_simpler)

* Add a comment about 'use strict'
  • Loading branch information
quentinvernot authored and mesaugat committed Nov 30, 2018
1 parent d75385e commit 50e4858
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/chai-exclude.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const fclone = require('fclone')

module.exports = (chai, utils) => {
module.exports = function (chai, utils) {
const assert = chai.assert
const Assertion = chai.Assertion

Expand Down Expand Up @@ -121,6 +121,9 @@ module.exports = (chai, utils) => {
val = removeKeysFrom(val, props, true)
}

// In case of 'use strict' and babelified code
arguments[0] = val;

_super.apply(this, arguments)
}
}
Expand Down

0 comments on commit 50e4858

Please sign in to comment.