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

@ebflat9/fp

Package Overview
Dependencies
Maintainers
1
Versions
160
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ebflat9/fp - npm Package Compare versions

Comparing version 1.0.16 to 1.0.17

4

index.js

@@ -1,3 +0,3 @@

import { Maybe, Result, Try, TryAsync, IO, IOAsync } from './maybe.js'
export { Maybe, Result, Try, TryAsync, IO, IOAsync }
import { Maybe, Result, Try, TryAsync, IO, IOAsync, Pair, Triple, Enum } from './maybe.js'
export { Maybe, Result, Try, TryAsync, IO, IOAsync, Pair, Triple, Enum }
/*

@@ -4,0 +4,0 @@ * My lil functional programming collection

@@ -262,3 +262,3 @@ import { isFunction, compose, composeAsync } from './index.js'

export class IOAsync {
[Symbol.toString] = 'IOAsync'
[Symbol.toStringTag] = 'IOAsync'

@@ -287,1 +287,119 @@ constructor(fn) {

}
export class Pair {
#left
#right;
[Symbol.toStringTag] = 'Pair'
constructor(left, right) {
this.#left = left
this.#right = right
}
get left() {
return this.#left
}
get right() {
return this.#right
}
get() {
return { left: this.#left, right: this.#right }
}
map(fn) {
return new Pair(fn(this.#left), fn(this.#right))
}
flatMap(fn) {
return new Pair(...fn(this.#left, this.#right))
}
toString() {
return `Pair {${this.#left}, ${this.#right}}`
}
toJSON() {
return { type: 'Pair', value: this.get() }
}
*[Symbol.iterator]() {
yield this.#left
yield this.#right
}
static of(left, right) {
return new Pair(left, right)
}
static eq(pairA, pairB) {
return pairA.left === pairB.left && pairA.right === pairB.right
}
}
export class Triple {
#left
#middle
#right;
[Symbol.toStringTag] = 'Triple'
constructor(left, middle, right) {
this.#left = left
this.#middle = middle
this.#right = right
}
get left() {
return this.#left
}
get middle() {
return this.#middle
}
get right() {
return this.#right
}
get() {
return { left: this.#left, middle: this.#middle, right: this.#right }
}
map(fn) {
return new Triple(fn(this.#left), fn(this.#middle), fn(this.#right))
}
flatMap(fn) {
return new Triple(...fn(this.#left, this.#middle, this.#right))
}
toString() {
return `Triple {${this.#left}, ${this.#middle}, ${this.#right}}`
}
toJSON() {
return { type: 'Triple', value: this.get() }
}
*[Symbol.iterator]() {
yield this.#left
yield this.#middle
yield this.#right
}
static of(left, middle, right) {
return new Triple(left, middle, right)
}
static eq(tripleA, tripleB) {
return (
tripleA.left === tripleB.left &&
tripleA.middle === tripleB.middle &&
tripleA.right === tripleB.right
)
}
}
export class Enum {
#types = new Set();
[Symbol.toStringTag] = 'Enum'
constructor(types) {
types.forEach(type => this.#types.add(type))
}
has(type) {
return this.#types.has(type)
}
toString() {
return `Enum [${[...this.#types].join(', ')}]`
}
toJSON() {
return { type: 'Enum', value: [...this.#types] }
}
[Symbol.iterator]() {
return this.#types[Symbol.iterator]
}
static of(...types) {
return new Enum(types)
}
}
{
"name": "@ebflat9/fp",
"version": "1.0.16",
"version": "1.0.17",
"description": "my fp utils",

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