You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since nobody asked for it -- I thought I'd parse CSV into objects, instead of arrays of arrays. Yes I know Arrays are objects but I mean the other kind, the object kind of objects.
Ever need to parse CSV with TypeScript, no? Me niether but here goes.
I redid this one so that can handle quotes more correctly. No that CSV actually parsable, but at least it may almost might be right. I'd like to add csv to objects instead of array of arrays... but I gotta think on that.
typeLine<T,Dextendsstring=',',Rextendsstring[]=[]>=Textends'' ? R :
Say you have a string type and you want to conver to an tupple(array) type. I dunno
why, maybe your writing some bad ass TypeScript and this seemed smart.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If you write a function, have some paths that don't return anything. The longer the function the better this works. The caller will never know what to expect. Also don't always return the same thing. Creative thinking like this make relationships work.
Parameter order doesn't matter.
Most languages care a lot about parameter order, but you don't have to. Trust your gut and do whatever. Optional, snoptional it can go first. Better yet in the untyped languages figure out what the parameters are. This is where not documenting things really shine.
Typescript 4.1 introduces recursive types and string literals, which
will finally allow one to type the ubiquitous get functions.
Often in JS we want to safely descend an object tree. Without
having to null check all the way down. So people for generations
have written various get implementations, but they all more or else look like