You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Object destructuring broken: variables are bound to the wrong object #9363
Yui (@yuit) fyi, in a function with two parameters, each representing objects with properties that can be destructured, it doesn't matter whether the function expects something or nothing from any of these objects, if either null or undefined is passed in to either of these parameters by the client code, an exception should be raised.
Example:
functionsomething({},{foo, bar}){// ...}functionanother(viaIdentifier,{ foo, bar }){// ...}something(undefined,{foo: 'foo',bar: 'bar'});// This is an ERROR, because the first parameter is set to undefined, and the// function `something` was declared to have the first parameter be// destructured, even if we aren't asking for any properties from itanother(undefined,{foo: 'foo',bar: 'bar'});// This is perfectly fine, because the first parameter is not destructured in// function declaration of `another`
Activity
mhegazy commentedon Jun 26, 2016
Yui (@yuit) can you take a look.
shovon commentedon Jun 26, 2016
Yui (@yuit) fyi, in a function with two parameters, each representing objects with properties that can be destructured, it doesn't matter whether the function expects something or nothing from any of these objects, if either null or undefined is passed in to either of these parameters by the client code, an exception should be raised.
Example:
[-]Object dstructuring broken: variables are bound to the wrong object[/-]yuit commentedon Jun 27, 2016
Sal Rahman (@shovon) I got the fix for the first comment. I am investigating your second comment
yuit commentedon Jun 29, 2016
Sal Rahman (@shovon) I have another PR to fix your second comment, if you would like to take a look !