throw an error when destructuring a null or undefined value on an empty object pattern - fixes #681
This commit is contained in:
1
test/fixtures/transformation/es6-destructuring/empty-object-pattern/actual.js
vendored
Normal file
1
test/fixtures/transformation/es6-destructuring/empty-object-pattern/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
var {} = null;
|
||||
3
test/fixtures/transformation/es6-destructuring/empty-object-pattern/exec.js
vendored
Normal file
3
test/fixtures/transformation/es6-destructuring/empty-object-pattern/exec.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
assert.throws(function () {
|
||||
var {} = null;
|
||||
}, /Cannot destructure undefined/);
|
||||
7
test/fixtures/transformation/es6-destructuring/empty-object-pattern/expected.js
vendored
Normal file
7
test/fixtures/transformation/es6-destructuring/empty-object-pattern/expected.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var _objectDestructuringEmpty = function (obj) { if (obj == null) throw new TypeError("Cannot destructure undefined"); };
|
||||
|
||||
var _ref = null;
|
||||
|
||||
_objectDestructuringEmpty(_ref);
|
||||
Reference in New Issue
Block a user