New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

neverthrow

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

neverthrow - npm Package Compare versions

Comparing version 2.6.0 to 2.7.0

3

dist/index.cjs.js

@@ -226,2 +226,5 @@ 'use strict';

};
ResultAsync.prototype.unwrapOr = function (t) {
return this._promise.then(function (res) { return res.unwrapOr(t); });
};
// Makes ResultAsync awaitable

@@ -228,0 +231,0 @@ ResultAsync.prototype.then = function (successCallback) {

@@ -43,2 +43,3 @@ declare type Result<T, E> = Ok<T, E> | Err<T, E>;

match<A>(ok: (t: T) => A, _err: (e: E) => A): Promise<A>;
unwrapOr(t: T): Promise<T>;
then<A>(successCallback: (res: Result<T, E>) => A): Promise<A>;

@@ -45,0 +46,0 @@ }

@@ -222,2 +222,5 @@ // eslint-disable-next-line @typescript-eslint/no-use-before-define

};
ResultAsync.prototype.unwrapOr = function (t) {
return this._promise.then(function (res) { return res.unwrapOr(t); });
};
// Makes ResultAsync awaitable

@@ -224,0 +227,0 @@ ResultAsync.prototype.then = function (successCallback) {

2

package.json
{
"name": "neverthrow",
"version": "2.6.0",
"version": "2.7.0",
"description": "Stop throwing errors, and instead return Results!",

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

@@ -335,5 +335,3 @@ # NeverThrow 🙅

const unwrapped: number = myResult
.map(multiply)
.unwrapOr(10)
const unwrapped: number = myResult.map(multiply).unwrapOr(10)
```

@@ -656,2 +654,22 @@

### `ResultAsync.unwrapOr` (method)
Unwrap the `Ok` value, or return the default if there is an `Err`.
Works just like `Result.unwrapOr` but returns a `Promise<T>` instead of `T`.
**Signature:**
```typescript
unwrapOr<T>(v: T): Promise<T> { ... }
```
**Example**:
```typescript
const unwrapped: number = await errAsync(0).unwrapOr(10)
// unwrapped = 10
```
---
### `ResultAsync.andThen` (method)

@@ -658,0 +676,0 @@

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