fix: early return when instance is not iterable (#10396)

* fix: early return when instance is not iterable

* chore: update test fixtures

* fix: gaurd against arguments for old browsers
This commit is contained in:
Huáng Jùnliàng
2019-09-06 12:09:57 -04:00
committed by Nicolò Ribaudo
parent 8da9d8b4b8
commit b64cb9aaf1
5 changed files with 18 additions and 4 deletions

View File

@@ -0,0 +1,9 @@
expect(
() => {
var [foo, bar] = undefined;
}).toThrow("Invalid attempt to destructure non-iterable instance");
expect(
() => {
var foo = [ ...undefined ];
}).toThrow("Invalid attempt to spread non-iterable instance");