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 1.2.1 to 1.2.2

index.d.ts

22

index.js
const EitherType = {
Left: "Left",
Right: "Right",
Right: "Right"
};

@@ -8,3 +8,3 @@ function isWrappedFunction(m) {

}
exports.Either = class Either {
class Either {
constructor(type, value) {

@@ -14,5 +14,19 @@ this.type = type;

}
static merge(eithers) {
static mergeInOne(eithers) {
return eithers.reduce((res, v) => v.chain(v => res.map(res => res.concat([v]))), Either.right([]));
}
static mergeInMany(eithers) {
return eithers.reduce((res, v) => {
if (res.isLeft()) {
if (v.isLeft()) {
return Either.left(res.value.concat([v.value]));
}
return res;
}
if (v.isLeft()) {
return Either.left([v.value]);
}
return v.chain(v => res.map(res => res.concat([v])));
}, Either.right([]));
}
static from(v) {

@@ -88,1 +102,3 @@ return this.right(v);

}
Either.merge = Either.mergeInOne;
module.exports = Either;

2

index.ts

@@ -14,3 +14,3 @@ import { Monad } from "@sweet-monads/interfaces";

export class Either<L, R> implements Monad<R> {
export default class Either<L, R> implements Monad<R> {
static mergeInOne<L1, R1>(values: [Either<L1, R1>]): Either<L1, [R1]>;

@@ -17,0 +17,0 @@ static mergeInOne<L1, R1, L2, R2>(

{
"name": "@sweet-monads/either",
"version": "1.2.1",
"version": "1.2.2",
"description": "Either monad",

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

@@ -22,3 +22,3 @@ # @sweet-monads/either

```typescript
import { Either } from "@sweet-monads/either";
import Either from "@sweet-monads/either";

@@ -25,0 +25,0 @@ class UserNotFoundError extends Error { name: "UserNotFoundError" };

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