@teawithsand/tws-lts
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

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

Package Sidebar

Install

npm i @teawithsand/tws-lts

Weekly Downloads

4

Version

0.0.3

License

MIT

Unpacked Size

69.1 kB

Total Files

75

Last publish

Collaborators

  • teawithsand