Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ts-results

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-results - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

2

index.d.ts
export declare class Err<E> {
readonly val: E;
static readonly EMPTY: Err<void>;
readonly ok = false;

@@ -18,2 +19,3 @@ readonly err = true;

readonly val: T;
static readonly EMPTY: Ok<void>;
readonly ok = true;

@@ -20,0 +22,0 @@ readonly err = false;

@@ -43,2 +43,3 @@ export class Err {

}
Err.EMPTY = new Err(undefined);
export class Ok {

@@ -70,2 +71,3 @@ constructor(val) {

}
Ok.EMPTY = new Ok(undefined);
export function Results(...results) {

@@ -72,0 +74,0 @@ const okResult = [];

2

package.json
{
"name": "ts-results",
"version": "2.0.0",
"version": "2.0.1",
"description": "A typescript implementation of Rust's Result object.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -16,2 +16,3 @@ # ts-results

* [Else](#else)
* [Empty](#empty)
* [Combining Results](#combining-results)

@@ -152,2 +153,13 @@ * [Usage with rxjs](#usage-with-rxjs)

#### Empty
```typescript
function checkIsValid(isValid: boolean): Result<void, Error> {
if (isValid) {
return Ok.EMPTY;
} else {
return new Err(new Error("Not valid"))
}
}
```
#### Combining Results

@@ -154,0 +166,0 @@ There may be some cases where we have two or more separate `Result` objects and we want to do something with both values.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc