<div dir="auto">Yes :) <div dir="auto"><br></div><div dir="auto">This is roughly what I had in mind:</div><div dir="auto"><br></div><div dir="auto">match obj with </div><div dir="auto">  {a, b : 5} -> return a + b</div><div dir="auto">  {a, c : {d, e : true}} -> return a + d</div><div dir="auto">  'rof' -> return 'lol'</div><div dir="auto"><br></div><div dir="auto">Where the first clause matches if obj has the property a and the property b that has the value 5.</div><div dir="auto">The second clause works the same but recursively.</div><div dir="auto">And the third simply checks if obj is equal to 'rof'.</div><br><div class="gmail_extra" dir="auto"><br><div class="gmail_quote">Den 30 juni 2017 16:46 skrev "Sebastian Malton" <<a href="mailto:sebastian@malton.name" target="_blank">sebastian@malton.name</a>>:<br type="attribution"><blockquote class="m_-3016798789026122312quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="background-color:rgb(255,255,255);background-image:initial;line-height:initial"><div id="m_-3016798789026122312m_-5447200774817782278response_container_BBPPID" style="outline:none;font-size:initial;font-family:"Calibri","Slate Pro",sans-serif,"sans-serif"" dir="auto"> <div name="BB10" dir="auto" style="width:100%;padding:initial;font-size:initial;text-align:initial;background-color:rgb(255,255,255)">Are you thinking kind of like Rust's match statement? I think that something like that would be quite a good addition.</div><div name="BB10" id="m_-3016798789026122312m_-5447200774817782278BB10_response_div_BBPPID" dir="auto" style="width:100%;padding:initial;font-size:initial;text-align:initial;background-color:rgb(255,255,255)"><br></div><div name="BB10" id="m_-3016798789026122312m_-5447200774817782278BB10_response_div_BBPPID" dir="auto" style="width:100%;padding:initial;font-size:initial;text-align:initial;background-color:rgb(255,255,255)">Sebastian </div>                                                                                                                                      <div name="BB10" dir="auto" style="width:100%;padding:initial;font-size:initial;text-align:initial;background-color:rgb(255,255,255)"> <br style="display:initial"></div>                            <div id="m_-3016798789026122312m_-5447200774817782278blackberry_signature_BBPPID" name="BB10" dir="auto">     <div name="BB10" dir="auto" style="padding:initial;font-size:initial;text-align:initial;background-color:rgb(255,255,255)"></div> </div></div><div id="m_-3016798789026122312m_-5447200774817782278_original_msg_header_BBPPID" dir="auto">                                                                                                                                             <table width="100%" style="background-color:white;border-spacing:0px;display:table;outline:none"> <tbody><tr><td colspan="2" style="padding:initial;font-size:initial;text-align:initial;background-color:rgb(255,255,255)">                           <div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(181,196,223);padding:3pt 0in 0in;font-family:Tahoma,"BB Alpha Sans","Slate Pro";font-size:10pt">  <div id="m_-3016798789026122312m_-5447200774817782278from"><b>From:</b> <a href="mailto:henrik.sommerland@gmail.com" target="_blank">henrik.sommerland@gmail.com</a></div><div id="m_-3016798789026122312m_-5447200774817782278sent"><b>Sent:</b> June 30, 2017 9:55 AM</div><div id="m_-3016798789026122312m_-5447200774817782278to"><b>To:</b> <a href="mailto:es-discuss@mozilla.org" target="_blank">es-discuss@mozilla.org</a></div><div id="m_-3016798789026122312m_-5447200774817782278subject"><b>Subject:</b> Pattern matching?</div></div></td></tr></tbody></table><div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(186,188,209);display:block;padding:initial;font-size:initial;text-align:initial;background-color:rgb(255,255,255)"></div> <br> </div><div class="m_-3016798789026122312elided-text"><div name="BB10" dir="auto" style="background-image:initial;line-height:initial;outline:none"><div dir="ltr">Why is there no support for pattern matching in JavaScript?<br>I would guess that it has been proposed before, and if so why hasn't it been included?<br><br>I have been thinking about it and I think it would integrate nicely into JavaScript.<br>If it hasn't been proposed already I would propose it, and I would gladly look into it more and try to examine what kind of semantics would be suitable.<br clear="all"><div><br>Peace!</div>-- <br><div class="m_-3016798789026122312m_-5447200774817782278gmail_signature"><div dir="ltr">Henrik "TheGrandmother" Sommerland</div></div>
</div>
</div></div></div></blockquote></div><br></div></div>