<div dir="ltr">hm, personally, I find it useful when extracting properties from objects!<div><br></div><div>I have myself been in situations where I had to deal with "all other properties except...".</div><div>An alternative would be simply extract it normally, but ignore it (which triggers complaints from linters).</div><div><br></div><div>Perhaps `!` could be a better option (makes me think of .gitignore and other list remove syntaxes.</div><div><br></div><div><pre style="white-space:pre-wrap;background-color:rgb(246,248,250);border-radius:3px;box-sizing:border-box;font-family:sfmono-regular,consolas,"liberation mono",menlo,monospace;font-size:13.6px;line-height:1.45;margin-bottom:0px;margin-top:0px;overflow:auto;padding:16px;word-break:normal"><span style="box-sizing:border-box;color:rgb(215,58,73)">const </span><span style="box-sizing:border-box"><font color="#000000">{ propA, propB, !</font></span>keyToRemove, <font color="#000000">...other }</font><span style="font-size:13.6px"> </span><span style="font-size:13.6px;box-sizing:border-box;color:rgb(0,92,197)">=</span><span style="font-size:13.6px"> objectA</span>;</pre><div><br></div><div>Note that, if you are not getting the "rest" of the properties in an `...other` constant, it would not be as useful.</div><div>In this case, keyToRemove would NOT be declared, and other would have all properties except propA, propB and keyToRemove.</div><div><br></div><div>Other thing I find rather annoying is the way we have to deal with some APIs when we are trying to "clean" their returned objects.</div><div>Like so:</div><div><br></div><div><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-size:16px;line-height:24px;white-space:pre"><br><div><span style="color:rgb(86,156,214);font-style:italic">function</span> <span style="color:rgb(220,220,170)">cleanData</span> (<span style="color:rgb(156,220,254)">data</span>) {</div><div>  <span style="color:rgb(86,156,214)">const</span> { <span style="color:rgb(156,220,254)">propA</span>, <span style="color:rgb(156,220,254)">propB</span>, <span style="color:rgb(156,220,254)">propC</span>, <span style="color:rgb(156,220,254)">propD</span>, <span style="color:rgb(156,220,254)">propE</span> } = <span style="color:rgb(156,220,254)">data</span>;</div><div>  <span style="color:rgb(197,134,192)">return</span> { <span style="color:rgb(156,220,254)">propA</span>, <span style="color:rgb(156,220,254)">propB</span>, <span style="color:rgb(156,220,254)">propC</span>, <span style="color:rgb(156,220,254)">propD</span>, <span style="color:rgb(156,220,254)">propE</span> };</div><div>}</div></div></div><div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><span style="color:rgb(51,51,51);font-family:arial,helvetica,sans-serif;font-size:12.8px">Perhaps something like this could become an option?!<br><br></span><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-size:16px;line-height:24px;white-space:pre"><br><div><span style="color:rgb(86,156,214);font-style:italic">function</span> <span style="color:rgb(220,220,170)">cleanData</span> (<span style="color:rgb(156,220,254)">data</span>) {</div><div>  <span style="color:rgb(86,156,214)">const</span> { <span style="color:rgb(156,220,254)">propA</span>, <span style="color:rgb(156,220,254)">propB</span>, <span style="color:rgb(156,220,254)">propC</span>, <span style="color:rgb(156,220,254)">propD</span>, <span style="color:rgb(156,220,254)">propE</span> } <span style="color:rgb(156,220,254)">as</span> <span style="color:rgb(156,220,254)">newObj</span> = <span style="color:rgb(156,220,254)">data</span>;</div><div>  <span style="color:rgb(197,134,192)">return</span> <span style="color:rgb(156,220,254)">newObj</span>;</div><div>}</div><br></div></div><div><span style="color:rgb(51,51,51);font-family:arial,helvetica,sans-serif;font-size:12.8px"><br></span></div><div><span style="color:rgb(51,51,51);font-family:arial,helvetica,sans-serif;font-size:12.8px"><br></span></div><div><span style="color:rgb(51,51,51);font-family:arial,helvetica,sans-serif;font-size:12.8px"><br></span></div><div><span style="color:rgb(51,51,51);font-family:arial,helvetica,sans-serif;font-size:12.8px">[ ]s</span><br></div><div dir="ltr"><b><br></b></div><div dir="ltr"><b style="font-size:12.8px"><span style="font-family:arial,helvetica,sans-serif;color:rgb(51,51,51)">--</span></b></div><div dir="ltr"><b style="font-size:12.8px"><span style="font-family:arial,helvetica,sans-serif;color:rgb(51,51,51)"><br></span></b></div><div dir="ltr"><b style="font-size:12.8px"><span style="font-family:arial,helvetica,sans-serif;color:rgb(51,51,51)">Felipe N. Moura</span></b><br></div><div dir="ltr"><span style="font-family:arial,helvetica,sans-serif;color:rgb(0,0,153)">Web Developer, </span><span style="color:rgb(0,0,153);font-family:arial,helvetica,sans-serif;font-size:small"><a href="https://developers.google.com/experts/people/felipe-moura" target="_blank">Google Developer Expert</a>, </span><span style="font-size:12.8px;font-family:arial,helvetica,sans-serif;color:rgb(0,0,153)">Founder of </span><a href="https://braziljs.org/" style="font-size:12.8px" target="_blank">BrazilJS</a><span style="font-size:12.8px;font-family:arial,helvetica,sans-serif;color:rgb(0,0,153)">, </span><a href="http://nasc.io/" style="font-size:12.8px" target="_blank">Nasc</a> and <a href="https://on2.dev/" target="_blank">On2</a><span style="font-size:12.8px;font-family:arial,helvetica,sans-serif;color:rgb(0,0,153)">.</span></div><div dir="ltr"><br style="color:rgb(0,0,153)"><span style="color:rgb(0,0,153)">
Website:  </span><span style="font-family:arial,helvetica,sans-serif;color:rgb(0,0,153)"><a href="http://felipenmoura.com/" target="_blank">http://felipenmoura.com</a> / <a href="http://nasc.io/" target="_blank">http://nasc.io/</a> </span><br style="color:rgb(0,0,153)"><span style="color:rgb(0,0,153)">
Twitter:    </span><span style="font-family:arial,helvetica,sans-serif;color:rgb(0,0,153)"><a href="http://twitter.com/felipenmoura" target="_blank">@felipenmoura</a></span></div><div dir="ltr"><font color="#000099" face="arial, helvetica, sans-serif">Facebook: <a href="http://fb.com/felipenmoura" target="_blank">http://fb.com/felipenmoura</a><br></font><span style="color:rgb(0,0,153);font-size:12.8px">LinkedIn: </span><a href="http://goo.gl/qGmq" style="font-size:12.8px" target="_blank">http://goo.gl/qGmq</a></div><div dir="ltr"><div><span style="font-family:arial,helvetica,sans-serif;color:rgb(0,0,153)">---------------------------------</span><br style="font-family:arial,helvetica,sans-serif;color:rgb(51,51,153)"><font color="#ff9900" style="background-color:rgb(0,0,0)" face="arial, sans-serif"><b> Changing  the  world</b> </font><span style="background-color:rgb(255,153,0)"><font face="arial, sans-serif"> is the least I expect from  myself!</font> </span><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, May 3, 2020 at 6:57 AM devlato <<a href="mailto:ecma6@devlato.com">ecma6@devlato.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>Hey folks,</div><div> </div><div>I've figured out a potential improvement for the object spread syntax and want to share my thoughts.</div><div>I've drafted my thoughts into a proposal available here: <a href="https://github.com/devlato/proposal-plus-minus-spread/blob/master/README.md" target="_blank">https://github.com/devlato/proposal-plus-minus-spread</a></div><div> </div><div>Long story short, I want to propose a new **minus operator**, that would allow specify keys to remove the values from a result of object spread. It would look like this:</div><div> </div><div><pre style="background-color:rgb(246,248,250);border-radius:3px;box-sizing:border-box;color:rgb(36,41,46);font-family:sfmono-regular,consolas,"liberation mono",menlo,monospace;font-size:13.6px;font-style:normal;font-weight:400;line-height:1.45;margin-bottom:0px;margin-top:0px;overflow:auto;padding:16px;text-decoration-style:initial;text-indent:0px;text-transform:none;word-break:normal;word-spacing:0px"><span style="box-sizing:border-box;color:rgb(215,58,73)">const</span> <span style="box-sizing:border-box">result</span> <span style="box-sizing:border-box;color:rgb(0,92,197)">=</span> <span style="box-sizing:border-box">{</span>
  ...<span style="box-sizing:border-box">objA,</span>
  ...<span style="box-sizing:border-box">objB,</span>
  <span style="box-sizing:border-box;color:rgb(0,92,197)">-</span>keyToRemove<span style="box-sizing:border-box">,</span>
<span style="box-sizing:border-box">};</span>

<span style="box-sizing:border-box;color:rgb(106,115,125)">// Or like this – the same result!</span>
<span style="box-sizing:border-box;color:rgb(215,58,73)">const</span> <span style="box-sizing:border-box">result</span> <span style="box-sizing:border-box;color:rgb(0,92,197)">=</span> <span style="box-sizing:border-box">{</span>
  ...<span style="box-sizing:border-box">objA,</span>
  <span style="box-sizing:border-box;color:rgb(0,92,197)">-</span>keyToRemove<span style="box-sizing:border-box">,</span>
  ...<span style="box-sizing:border-box">objB,</span>
<span style="box-sizing:border-box">};</span>

<span style="box-sizing:border-box;color:rgb(106,115,125)">// And this!</span>
<span style="box-sizing:border-box;color:rgb(215,58,73)">const</span> <span style="box-sizing:border-box">result</span> <span style="box-sizing:border-box;color:rgb(0,92,197)">=</span> <span style="box-sizing:border-box">{</span>
  <span style="box-sizing:border-box;color:rgb(0,92,197)">-</span>keyToRemove<span style="box-sizing:border-box">,</span>
  ...<span style="box-sizing:border-box">objA,</span>
  ...<span style="box-sizing:border-box">objB,</span>
<span style="box-sizing:border-box">};</span></pre></div><div> </div><div>What do you folks think?</div><div> </div><div>Warmest regards,</div><div>Denis</div><div> </div>_______________________________________________<br>
es-discuss mailing list<br>
<a href="mailto:es-discuss@mozilla.org" target="_blank">es-discuss@mozilla.org</a><br>
<a href="https://mail.mozilla.org/listinfo/es-discuss" rel="noreferrer" target="_blank">https://mail.mozilla.org/listinfo/es-discuss</a><br>
</blockquote></div>