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
63
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

to
3.1.1

2

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

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

@@ -36,3 +36,3 @@ # NeverThrow 🙅

- [`Result.asyncMap` (method)](#resultasyncmap-method)
- [`Result.fromThrowable`](#resultfromthrowable)
- [`Result.fromThrowable` (static class method)](#resultfromthrowable)
+ [Asynchronous API (`ResultAsync`)](#asynchronous-api-resultasync)

@@ -430,4 +430,6 @@ - [`okAsync`](#okasync)

#### `Result.fromThrowable`
#### `Result.fromThrowable` (static class method)
> Although Result is not an actual JS class, the way that `fromThrowable` has been implemented requires that you call `fromThrowable` as though it were a static method on `Result`. See examples below.
The JavaScript community has agreed on the convention of throwing exceptions.

@@ -447,3 +449,3 @@ As such, when interfacing with third party libraries it's imperative that you

```typescript
import { fromThrowable } from 'neverthrow'
import { Result } from 'neverthrow'

@@ -453,3 +455,3 @@ type ParseError = { message: string }

const safeJsonParse = fromThrowable(JSON.parse, toParseError)
const safeJsonParse = Result.fromThrowable(JSON.parse, toParseError)

@@ -456,0 +458,0 @@ // the function can now be used safely, if the function throws, the result will be an Err