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

@sweet-monads/maybe

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/maybe - npm Package Compare versions

Comparing version 2.2.1 to 2.2.2

39

index.js
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var MaybeConstructor_1;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isMaybe = exports.chain = exports.from = exports.none = exports.just = exports.merge = void 0;
const interfaces_1 = require("@sweet-monads/interfaces");
var MaybeState;

@@ -20,3 +12,3 @@ (function (MaybeState) {

}
let MaybeConstructor = MaybeConstructor_1 = class MaybeConstructor {
class MaybeConstructor {
constructor(type, value) {

@@ -30,3 +22,3 @@ this.type = type;

static merge(maybies) {
return maybies.reduce((res, v) => v.chain(v => res.map(res => res.concat([v]))), MaybeConstructor_1.just([]));
return maybies.reduce((res, v) => v.chain(v => res.map(res => res.concat([v]))), MaybeConstructor.just([]));
}

@@ -37,6 +29,6 @@ static from(v) {

static none() {
return new MaybeConstructor_1("None", undefined);
return new MaybeConstructor("None", undefined);
}
static just(v) {
return new MaybeConstructor_1("Just", v);
return new MaybeConstructor("Just", v);
}

@@ -54,15 +46,15 @@ isNone() {

if (this.isJust()) {
return MaybeConstructor_1.just(f(this.value));
return MaybeConstructor.just(f(this.value));
}
return MaybeConstructor_1.none();
return MaybeConstructor.none();
}
asyncMap(f) {
if (this.isJust()) {
return f(this.value).then(MaybeConstructor_1.just);
return f(this.value).then(MaybeConstructor.just);
}
return Promise.resolve(MaybeConstructor_1.none());
return Promise.resolve(MaybeConstructor.none());
}
apply(argOrFn) {
if (this.isNone() || argOrFn.isNone()) {
return MaybeConstructor_1.none();
return MaybeConstructor.none();
}

@@ -79,3 +71,3 @@ if (isWrappedFunction(this)) {

if (this.isNone() || argOrFn.isNone()) {
return Promise.resolve(MaybeConstructor_1.none());
return Promise.resolve(MaybeConstructor.none());
}

@@ -94,3 +86,3 @@ if (isWrappedFunction(this)) {

}
return MaybeConstructor_1.none();
return MaybeConstructor.none();
}

@@ -101,3 +93,3 @@ asyncChain(f) {

}
return Promise.resolve(MaybeConstructor_1.none());
return Promise.resolve(MaybeConstructor.none());
}

@@ -107,8 +99,3 @@ or(x) {

}
};
MaybeConstructor = MaybeConstructor_1 = __decorate([
interfaces_1.ClassImplements(),
interfaces_1.ClassImplements(),
interfaces_1.ClassImplements()
], MaybeConstructor);
}
exports.default = MaybeConstructor;

@@ -115,0 +102,0 @@ exports.merge = MaybeConstructor.merge, exports.just = MaybeConstructor.just, exports.none = MaybeConstructor.none, exports.from = MaybeConstructor.from, exports.chain = MaybeConstructor.chain;

{
"name": "@sweet-monads/maybe",
"version": "2.2.1",
"version": "2.2.2",
"description": "",

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

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