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

@sweet-monads/either

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sweet-monads/either - npm Package Compare versions

Comparing version 3.2.0 to 3.3.0

index.ts

4

package.json
{
"name": "@sweet-monads/either",
"version": "3.2.0",
"version": "3.3.0",
"description": "Either monad",

@@ -32,3 +32,3 @@ "main": "./cjs/index.js",

"dependencies": {
"@sweet-monads/interfaces": "^3.2.0"
"@sweet-monads/interfaces": "^3.3.0"
},

@@ -35,0 +35,0 @@ "author": "JSMonk",

@@ -61,2 +61,3 @@ # @sweet-monads/either

- [`Either#asyncChain`](#eitherasyncchain)
- [`Either#fold`](#eitherfold)
- [Helpers](#helpers)

@@ -501,2 +502,21 @@

##### `Either#fold`
```typescript
function fold<C>(mapLeft: (value: L) => C, mapRight: (value: R) => C): C;
```
- Returns values mapped by `mapRight` if `Either` is `Right`, otherwise value mapped by `mapLeft`
Example:
```typescript
const v1 = right<Error, number>(2);
const v2 = left<Error, number>(new Error());
// 4
const newVal1 = v1.fold(() => 'fail', value => value * 2);
// "fail"
const newVal2 = v2.fold(() => 'fail', value => value * 2);
```
#### Helpers

@@ -516,3 +536,3 @@

right(2).unwrap((; // number
right(2).unwrap(); // number
left(new TypeError()).unwrap(x => x); // throws TypeError provied in arguments

@@ -519,0 +539,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