Skip to content

Misc js utils migrated from tws-stl. Only most common stuff here.

License

Notifications You must be signed in to change notification settings

teawithsand/tws-lts

Repository files navigation

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!"))

About

Misc js utils migrated from tws-stl. Only most common stuff here.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published