waldo323_ | good morning | 11:00 |
---|---|---|
greg-g | hola | 12:15 |
waldo323_ | como estas? | 13:27 |
cmaloney | aGOod morning | 13:40 |
jrwren | so... 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 |
jrwren | Good morning. | 14:36 |
cmaloney | jrwren: Now now now ECMASCript 6 is amazeballs | 14:40 |
cmaloney | it's like JavaScript is a real language now instead of a series of poorly-though-out hacks | 14:40 |
cmaloney | but then again, when you're coming from a series of pooly thought out hacks I'm sure anything looks good by comparison | 14:41 |
jrwren | nope. | 14:41 |
jrwren | its still hell, not matter what you say. | 14:41 |
jrwren | e.g. | 14:41 |
jrwren | n=["hi","mom"] | 14:41 |
jrwren | now turn that into `{hi :"mom"}` programmatically. | 14:41 |
jrwren | I'm so dumb I don't know how. | 14:41 |
jrwren | {n[0]:n[1]} doesn't work | 14:41 |
jrwren | Object.create({n[0]:n[1]}) doesn't work. | 14:42 |
jrwren | i'm just too stpuid to ever JS. | 14:42 |
cmaloney | jrwren: bar = {} | 14:44 |
cmaloney | jrwren: bar[foo[0]] = foo[1] | 14:44 |
cmaloney | (stack overflow) | 14:44 |
cmaloney | https://stackoverflow.com/questions/4215737/convert-array-to-object | 14:44 |
jrwren | wow. i'm dumb. | 14:45 |
cmaloney | Nah, you're doing something that I thought you could do | 14:46 |
cmaloney | but apparently the syntax isn't there for it | 14:46 |
jrwren | now 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 |
cmaloney | rewrite it in Python | 14:48 |
cmaloney | ;) | 14:48 |
jrwren | i wish. | 14:48 |
cmaloney | I find JavaScript syntax rather impenetrable when folks try to be clever | 14:48 |
jrwren | i'd be done already if it were asm, I feel. | 14:48 |
cmaloney | And that's coming from someone who used to make money doing Perl | 14:49 |
jrwren | zomg, it works. thank cmaloney | 14:49 |
jrwren | shit = hash.substring(1).split('&').map( p => p.split('=') ).reduce( (t,n) => { t[n[0]]=n[1]; return t; } ,{}); | 14:49 |
cmaloney | jrwren: Woo hoo! | 14:49 |
jrwren | dude, me too. I think i've still written more perl than js, even though I haven't written perl in 11 yrs. | 14:50 |
cmaloney | I still have NFC what that does. :) | 14:50 |
jrwren | it turns a & separated list of pairs sparated by = into a dictionary. | 14:50 |
cmaloney | It looks like it's doing URL hashing but I'm just going off of keywords | 14:50 |
cmaloney | Ah | 14:50 |
jrwren | blah=foo&bar=baz becomes {blah:"foo", "bar":"baz"} | 14:50 |
jrwren | its a damn shame it isn't cleaner still. | 14:51 |
cmaloney | right | 14:51 |
brousch | Seems like there should be a lib for that | 14:53 |
brousch | url unmangling | 14:53 |
jrwren | JS has no stdlib. | 15:01 |
jrwren | i hate npm so I refuse to pull modules | 15:01 |
jrwren | and... you just asked for a lib for 1 line of code. | 15:01 |
brousch | Welcome to JS | 15:19 |
jrwren | thank you for your kindness. I decline the welcome. I'd rather not enter or join. | 15:20 |
greg-g | hahaha | 15:32 |
cmaloney | heh | 15:32 |
cmaloney | to be fair, that one line of code should be a lib. ;) | 15:32 |
cmaloney | but because JavaScript is a write-only language anyway (JavaScript minification anyone?) it makes sense to just chain a bunch of functions together | 15:33 |
jrwren | i disagree strongly. | 15:42 |
jrwren | it 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 | ||
brousch | Good luck making that happen | 16:05 |
jrwren | it never will. | 16:07 |
jrwren | but 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 |
brousch | I miss jquery | 16:09 |
cmaloney | jquery is still out there | 16:11 |
cmaloney | but now we have about 15 other layers on top of it | 16:11 |
cmaloney | we're making it so our abstractions have abstracted abstractions on abstractions | 16:12 |
greg-g | every problem can be solved with another layer of abstraction | 16:13 |
jrwren | jquery select is built into the browser now! | 16:15 |
jrwren | it turns out it is built into the browser. | 16:25 |
jrwren | x = new URLSearchParams(stringwithampersandandequals) ; x.get("foo") -> bar | 16:26 |
cmaloney | Hah, that's awesome | 16:41 |
Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!