Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4881 from webpack/bugfix/destructing
support destructing on assignment
- Loading branch information
Showing
5 changed files
with
59 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export var test = "test"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { test } from "./file"; | ||
|
||
it("should allow import in array destructing", function() { | ||
var other; | ||
[other = test] = []; | ||
other.should.be.eql("test"); | ||
}); | ||
|
||
it("should allow import in object destructing", function() { | ||
var other; | ||
({other = test} = {}); | ||
other.should.be.eql("test"); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
var supportsIteratorDestructuring = require("../../../helpers/supportsIteratorDestructuring"); | ||
var supportsObjectDestructuring = require("../../../helpers/supportsObjectDestructuring"); | ||
|
||
module.exports = function(config) { | ||
return !config.minimize && supportsObjectDestructuring() && supportsIteratorDestructuring(); | ||
}; |