/srv/irclogs.ubuntu.com/2018/05/18/#ubuntu-us-mi.txt

waldo323_good morning11:00
greg-ghola12:15
waldo323_como estas?13:27
cmaloneyaGOod morning13:40
jrwrenso... ya know how some peopel say that JS ain't so bad these day. It took me all of an hour to learn that is an absolute lie.14:35
jrwrenGood morning.14:36
cmaloneyjrwren: Now now now ECMASCript 6 is amazeballs14:40
cmaloneyit's like JavaScript is a real language now instead of a series of poorly-though-out hacks14:40
cmaloneybut then again, when you're coming from a series of pooly thought out hacks I'm sure anything looks good by comparison14:41
jrwrennope.14:41
jrwrenits still hell, not matter what you say.14:41
jrwrene.g.14:41
jrwrenn=["hi","mom"]14:41
jrwrennow turn that into `{hi :"mom"}` programmatically.14:41
jrwrenI'm so dumb I don't know how.14:41
jrwren{n[0]:n[1]} doesn't work14:41
jrwrenObject.create({n[0]:n[1]}) doesn't work.14:42
jrwreni'm just too stpuid to ever JS.14:42
cmaloneyjrwren: bar = {}14:44
cmaloneyjrwren: bar[foo[0]] = foo[1]14:44
cmaloney(stack overflow)14:44
cmaloneyhttps://stackoverflow.com/questions/4215737/convert-array-to-object14:44
jrwrenwow. i'm dumb.14:45
cmaloneyNah, you're doing something that I thought you could do14:46
cmaloneybut apparently the syntax isn't there for it14:46
jrwrennow how to do the same thing here: hash.substring(1).split('&').map( p => p.split('=') )//.reduce( (t,n) => Object.assign(t,{ n[0]: n[1] }),{})14:47
cmaloneyrewrite it in Python14:48
cmaloney;)14:48
jrwreni wish.14:48
cmaloneyI find JavaScript syntax rather impenetrable when folks try to be clever14:48
jrwreni'd be done already if it were asm, I feel.14:48
cmaloneyAnd that's coming from someone who used to make money doing Perl14:49
jrwrenzomg, it works. thank cmaloney14:49
jrwrenshit = hash.substring(1).split('&').map( p => p.split('=') ).reduce( (t,n) => { t[n[0]]=n[1]; return t; } ,{});14:49
cmaloneyjrwren: Woo hoo!14:49
jrwrendude, me too. I think i've still written more perl than js, even though I haven't written perl in 11 yrs.14:50
cmaloneyI still have NFC what that does. :)14:50
jrwrenit turns a & separated list of pairs sparated by = into a dictionary.14:50
cmaloneyIt looks like it's doing URL hashing but I'm just going off of keywords14:50
cmaloneyAh14:50
jrwrenblah=foo&bar=baz becomes {blah:"foo", "bar":"baz"}14:50
jrwrenits a damn shame it isn't cleaner still.14:51
cmaloneyright14:51
brouschSeems like there should be a lib for that14:53
brouschurl unmangling14:53
jrwrenJS has no stdlib.15:01
jrwreni hate npm so I refuse to pull modules15:01
jrwrenand... you just asked for a lib for 1 line of code.15:01
brouschWelcome to JS15:19
jrwrenthank you for your kindness. I decline the welcome. I'd rather not enter or join.15:20
greg-ghahaha15:32
cmaloneyheh15:32
cmaloneyto be fair, that one line of code should be a lib. ;)15:32
cmaloneybut because JavaScript is a write-only language anyway (JavaScript minification anyone?) it makes sense to just chain a bunch of functions together15:33
jrwreni disagree strongly.15:42
jrwrenit should be in the JS stdlib, one that all browsers ship, but if not that, then I don't want it as a 3rd party lib.15:42
=== Augustine_W8AWT is now known as w8awt
brouschGood luck making that happen16:05
jrwrenit never will.16:07
jrwrenbut it won't matter because node stdlib might get something and then node will compile to webasm and you'll never have a clue what is executing on your machine, just like now, only more so.16:08
brouschI miss jquery16:09
cmaloneyjquery is still out there16:11
cmaloneybut now we have about 15 other layers on top of it16:11
cmaloneywe're making it so our abstractions have abstracted abstractions on abstractions16:12
greg-gevery problem can be solved with another layer of abstraction16:13
jrwrenjquery select is built into the browser now!16:15
jrwrenit turns out it is built into the browser.16:25
jrwrenx = new URLSearchParams(stringwithampersandandequals) ; x.get("foo") -> bar16:26
cmaloneyHah, that's awesome16:41

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!