tr-utilities-lib
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

Tom Raaff's utilities library

Not meant for use in Production. This is a personal library and is maintained to fit my own needs.

Publishing notes

  • modify the prepublishOnly script for the version major | minor | patch
  • Publish npm publish (will automatically run prepare and prepublishOnly first)

Installation

Run npm install tr-utilities-lib

Contents:

  • Collection
  • Maybe
  • Either
  • MergeObjects
  • VerifyType
  • Component

Collection

Basically an Array on steroids. See implementation

Maybe

** warning: probably buggy ** Also known as Option or Optional. It might contain a value. If not, it forces the user to handle the empty-scenario gracefully. See implementation

Either

** warning: probably buggy ** Meant to contain a happy-flow-response (called Right) or an unhappy-flow-response (called Left). See implementation

MergeObjects

Meant to merge objects where all fields of the second object will overwrite fields of the first object. Includes nesting and arrays. Does not support multi-dimensional arrays yet.

ValidateType

Meant for runtime validation of incoming objects over http. Whenever you do an HTTP-request, you cannot know for certain what comes in, so you'd better validate in runtime.

Readme

Keywords

Package Sidebar

Install

npm i tr-utilities-lib

Weekly Downloads

1

Version

2.0.1

License

ISC

Unpacked Size

270 kB

Total Files

8

Last publish

Collaborators

  • tomraaff