0.0.1 • Published 10 months ago

@teawithsand/tws-lts-react v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

tws-lts

LTS and not-so-frequently changing port of tws-stl, which is part of tws-libs

Docs

Go to github pages for documentation

generateUuid

Quite boring, just generates uuid using WebCrypto API if available. Fallbacks to Math.random

throwExpression and throwExpressionLazy

These are quite interesting, they let you do kotlin-style ?:

const mayFail = (): string | null => {
    if(Math.random() > .5) {
        return "OK"
    }

    return null
}

// This compiles! Notice string type instead of string | null 
const res: string = mayFail() ?? throwExpression(new Error("Oops, it failed!"))