also I never actually want arbitrary flattening - if my data is arbitrarily deep, I want an interpreter or visitor - if my data is one level deep, I want flatMap - if I don't know how deep it is, I have a design problem
-
-
Replying to @mountain_ghosts
I'm with you that flatten should always be `flatMap(id)`. FWIW, `Array.prototype.flat` lets you pass a depth, but it defaults to 1 so other than the hole thing it is identical to `flatMap(id)`
1 reply 0 retweets 0 likes -
Replying to @sgrif @mountain_ghosts
Wow I really thought I was done being surprised by weird random shit in JSpic.twitter.com/Sja5Kj2S7k
2 replies 1 retweet 3 likes -
Replying to @sgrif @mountain_ghosts
Have you seen how an array’s length property is defined? https://www.ecma-international.org/ecma-262/5.1/#sec-15.4 … tl;dr it looks at properties on the object, determines which are array indexes, adds one to the largest, and bam, length.
1 reply 0 retweets 0 likes -
Replying to @brianarn @mountain_ghosts
> object has a length property whose value is always a nonnegative integer I'm pretty sure this is for a different language
1 reply 0 retweets 0 likes -
Replying to @sgrif @mountain_ghosts
I mean, it’s a Number but it can also be a non-negative integer
1 reply 0 retweets 0 likes -
Replying to @brianarn @mountain_ghosts
"The language spec has the concept of integers you just don't get to use them"
2 replies 0 retweets 0 likes -
-
lemme just [0, 1, 2, 3, 4].map(parseInt)
1 reply 0 retweets 2 likes -
Replying to @mountain_ghosts @sgrif
I once had a funky bug that was basically this, where the second argument in a map function caused unexpected behaviors, good times
2 replies 0 retweets 0 likes
I'm pretty sure having this bug at least once (preferably more than 3 times) is a hard requirement to call yourself a JS programmer.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.