@giancosta86/swan-lake v3.1.0
swan-lake
Elegant TypeScript extensions
swan-lake is a library providing useful and minimalist extensions for the TypeScript language.
Installation
The package on NPM is:
@giancosta86/swan-lake
The public API entirely resides in the root package index, so one shouldn't reference specific modules.
Usage
ImmediateOrPromise<T>- can be assigned aTor aPromise<T>AnyClassis an alias forFunction- to express a class, even ones having aprivateconstructorHasEqualsis an interface having anequals(other): booleanmethod, whereotherbelongs to the same type or a structurally compatible oneNoneis declared asundefined | nullOptionalis a namespace including:map- returnsundefinedif the input value isnullorundefined, but applies the given mapper otherwiseequals- this function returnstrueif:both
leftandrightare eitherundefinedornullleftandrightare both defined andleft.equals(right)returnstrue
Please, note: this function does not check whether the two operands belong to the same type - according to TypeScript's structural equality; should you have such specific requirement, you'll need to perform a dedicated check.
ExpressiveUrl::create- creates a URL from a string - throwing a descriptive error on failure