guest271314 at gmail.com (2019-05-10T14:56:31.508Z)
The bytes used for code can be reduced. ```JSON.stringify()``` or ```JSON.parse()``` and ```replace()``` could be used. The original proposal mentions ```JSON```, though includes the case of
```
const { y =? 'a' } = { y: undefined }; // z === 'a'
```
which is not valid ```JSON``` but a JavaScript plain object. The brief
example handles ```JSON``` and/or JavaScript plain object input.
Is the actual input a ```JSON``` string?
There would probably at least that amount of code to implement the
extension to the ```=``` operator in JavaScript.
The bytes used for code can be reduced. Used redundancy in the original code to handle both cases at the actual examples at OP. ```JSON.stringify()``` and ```replace()``` could be used. The original proposal mentions ```JSON```, though includes the case of ``` const { y =? 'a' } = { y: undefined }; // z === 'a' ``` which is not valid ```JSON``` but a JavaScript plain object. The brief example handles ```JSON``` and/or JavaScript plain object input. There would probably at least that amount of code to implement the extension to the ```=``` operator in JavaScript. On Fri, May 10, 2019 at 8:58 AM Oliver Dunk <oliver at oliverdunk.com> wrote: > > Given input valid JSON JSON.parse() or JSON.stringify() replacer > function can be utilized to substitute "undefined" for null. > > guest271314, that’s a lot of code! It feels like if anything, your example > backs up the proposal. > > > `const { z =? 'a' } = { z: null };` > > I’m not sure I like the proposed syntax. The question mark indicates to me > that it’s the value on the lhs that’s optional - when in reality, it’s the > other way around. > _______________________________________________ > es-discuss mailing list > es-discuss at mozilla.org > https://mail.mozilla.org/listinfo/es-discuss > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20190510/532cbe29/attachment.html>