@verticalstrategy/datatypes
v1.0.2
Published
Useful general purpose datatypes with TypeScript support
Downloads
17
Readme
Datatypes for TypeScript
Additional datatypes for JavaScript.
Introduction
This module provides useful types that are a common in of other programming languages, but are not included in core JavaScript/TypeScript.
Installation
yarn add @verticalstrategy/datatypes
Types
| Type | Description | Documentation |
| -------- | ------------------------------ | ---------------------------------------------------------------- |
| Option
| Represent an optional value | Introduction / API |
| Result
| Represent a result or an error | Introduction / API |
Interfaces
| Interface | Description |
| ----------- | ------------------------------------------------ |
| ToPlain
| Classes that can export to a JSON-able JS type |
| FromPlain
| Classes that can import from a JSON-able JS type |
| Lazy
| Represents a lazy-loadable type |
Implementation in other languages
You may be familiar with some of the content of this module. Here are some analogs in other Programming Languages:
| Language | Other Name | Equivalent to | Reference |
| -------- | ---------- | ------------- | ------------------------------------------------------------------------------------ |
| Swift | Optional
| Option
| Swift docs |
| Rust | Option
| Option
| Rust docs |
| Rust | Result
| Result
| Rust docs |
| C# | Nullable
| Option
| C# docs |
| F# | Option
| Option
| F# docs |
| F# | Result
| Result
| F# docs |
Contributing
Contributions are always welcome in form of pull requests. Discussion or bug reports are created by opening new issues.