3.1.0 • Published 6 months ago

@giancosta86/swan-lake v3.1.0

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

swan-lake

Elegant TypeScript extensions

GitHub CI npm version MIT License

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 a T or a Promise<T>

  • AnyClass is an alias for Function - to express a class, even ones having a private constructor

  • HasEquals is an interface having an equals(other): boolean method, where other belongs to the same type or a structurally compatible one

  • None is declared as undefined | null

  • Optional is a namespace including:

    • map - returns undefined if the input value is null or undefined, but applies the given mapper otherwise

    • equals - this function returns true if:

      • both left and right are either undefined or null

      • left and right are both defined and left.equals(right) returns true

      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

3.1.0

6 months ago

3.0.0

6 months ago

2.0.1

6 months ago

2.0.0

6 months ago

1.0.0

6 months ago