Socket
Socket
Sign inDemoInstall

lil-fp

Package Overview
Dependencies
0
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.0 to 1.3.1

dist/chunk-NATELFDJ.mjs

2

dist/index.d.ts

@@ -7,3 +7,3 @@ export { a as Arr } from './arr-bf7e48d4.js';

export { o as Obj } from './obj-40a953aa.js';
export { o as Opt } from './opt-10c987bb.js';
export { o as Opt } from './opt-e7bb6428.js';
import './types.js';

@@ -9,6 +9,6 @@ "use strict";

__defProp(target, name, { get: all[name], enumerable: !0 });
}, __copyProps = (to, from3, except, desc) => {
if (from3 && typeof from3 == "object" || typeof from3 == "function")
for (let key of __getOwnPropNames(from3))
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from3[key], enumerable: !(desc = __getOwnPropDesc(from3, key)) || desc.enumerable });
}, __copyProps = (to, from4, except, desc) => {
if (from4 && typeof from4 == "object" || typeof from4 == "function")
for (let key of __getOwnPropNames(from4))
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from4[key], enumerable: !(desc = __getOwnPropDesc(from4, key)) || desc.enumerable });
return to;

@@ -212,2 +212,3 @@ };

flatMap: () => flatMap,
from: () => from3,
fromExecution: () => fromExecution,

@@ -222,5 +223,6 @@ fromNullable: () => fromNullable,

none: () => none,
some: () => some2
some: () => some2,
tap: () => tap2
});
var none = { _tag: "None" }, some2 = (value) => ({ _tag: "Some", value }), fromNullable = (value) => value == null ? none : some2(value), fromExecution = (value) => {
var none = { _tag: "None" }, some2 = (value) => ({ _tag: "Some", value }), from3 = (value) => some2(value), fromNullable = (value) => value == null ? none : some2(value), fromExecution = (value) => {
try {

@@ -231,7 +233,10 @@ return fromNullable(value());

}
}, isNone = (o) => o._tag === "None", isSome = (o) => o._tag === "Some", map3 = (f) => (o) => isNone(o) ? none : some2(f(o.value)), flatMap = (f) => (o) => isNone(o) ? none : f(o.value), getOrElse = (def) => (o) => isNone(o) ? def() : o.value, getOrThrow = (msg) => (o) => {
}, isNone = (o) => o._tag === "None", isSome = (o) => o._tag === "Some", isOption = (o) => o._tag === "None" || o._tag === "Some", map3 = (f) => (o) => isNone(o) ? none : some2(f(o.value)), flatMap = (f) => (o) => isNone(o) ? none : f(o.value), getOrElse = (def) => (o) => isNone(o) ? def() : o.value, getOrThrow = (msg) => (o) => {
if (isNone(o))
throw new Error(msg);
return o.value;
}, match2 = (onSome, onNone) => (o) => isNone(o) ? onNone() : onSome(o.value), alt2 = (v) => (o) => isNone(o) ? v() : o;
}, match2 = (onSome, onNone) => (o) => isNone(o) ? onNone() : onSome(o.value), alt2 = (v) => (o) => {
let vv = v();
return isOption(vv) ? isNone(o) ? vv : o : isNone(o) ? some2(vv) : o;
}, tap2 = (f) => (o) => (isSome(o) && f(o.value), o);
// Annotate the CommonJS export names for ESM import in node:

@@ -238,0 +243,0 @@ 0 && (module.exports = {

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

export { h as alt, c as flatMap, a as fromExecution, f as fromNullable, g as getOrElse, d as getOrThrow, i as isNone, b as isSome, m as map, e as match, n as none, s as some } from './opt-10c987bb.js';
export { j as alt, d as flatMap, f as from, b as fromExecution, a as fromNullable, g as getOrElse, e as getOrThrow, i as isNone, c as isSome, m as map, h as match, n as none, s as some, t as tap } from './opt-e7bb6428.js';

@@ -9,6 +9,6 @@ "use strict";

__defProp(target, name, { get: all[name], enumerable: !0 });
}, __copyProps = (to, from, except, desc) => {
if (from && typeof from == "object" || typeof from == "function")
for (let key of __getOwnPropNames(from))
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}, __copyProps = (to, from2, except, desc) => {
if (from2 && typeof from2 == "object" || typeof from2 == "function")
for (let key of __getOwnPropNames(from2))
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from2[key], enumerable: !(desc = __getOwnPropDesc(from2, key)) || desc.enumerable });
return to;

@@ -23,2 +23,3 @@ };

flatMap: () => flatMap,
from: () => from,
fromExecution: () => fromExecution,

@@ -33,6 +34,7 @@ fromNullable: () => fromNullable,

none: () => none,
some: () => some
some: () => some,
tap: () => tap
});
module.exports = __toCommonJS(opt_exports);
var none = { _tag: "None" }, some = (value) => ({ _tag: "Some", value }), fromNullable = (value) => value == null ? none : some(value), fromExecution = (value) => {
var none = { _tag: "None" }, some = (value) => ({ _tag: "Some", value }), from = (value) => some(value), fromNullable = (value) => value == null ? none : some(value), fromExecution = (value) => {
try {

@@ -43,7 +45,10 @@ return fromNullable(value());

}
}, isNone = (o) => o._tag === "None", isSome = (o) => o._tag === "Some", map = (f) => (o) => isNone(o) ? none : some(f(o.value)), flatMap = (f) => (o) => isNone(o) ? none : f(o.value), getOrElse = (def) => (o) => isNone(o) ? def() : o.value, getOrThrow = (msg) => (o) => {
}, isNone = (o) => o._tag === "None", isSome = (o) => o._tag === "Some", isOption = (o) => o._tag === "None" || o._tag === "Some", map = (f) => (o) => isNone(o) ? none : some(f(o.value)), flatMap = (f) => (o) => isNone(o) ? none : f(o.value), getOrElse = (def) => (o) => isNone(o) ? def() : o.value, getOrThrow = (msg) => (o) => {
if (isNone(o))
throw new Error(msg);
return o.value;
}, match = (onSome, onNone) => (o) => isNone(o) ? onNone() : onSome(o.value), alt = (v) => (o) => isNone(o) ? v() : o;
}, match = (onSome, onNone) => (o) => isNone(o) ? onNone() : onSome(o.value), alt = (v) => (o) => {
let vv = v();
return isOption(vv) ? isNone(o) ? vv : o : isNone(o) ? some(vv) : o;
}, tap = (f) => (o) => (isSome(o) && f(o.value), o);
// Annotate the CommonJS export names for ESM import in node:

@@ -53,2 +58,3 @@ 0 && (module.exports = {

flatMap,
from,
fromExecution,

@@ -63,3 +69,4 @@ fromNullable,

none,
some
some,
tap
});
{
"name": "lil-fp",
"version": "1.3.0",
"version": "1.3.1",
"description": "Functional programming utilities for TypeScript",

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

@@ -7,2 +7,3 @@ type Option<T> = None | Some<T>

export const some = <T>(value: T): Option<T> => ({ _tag: 'Some', value })
export const from = <T>(value: T): Option<T> => some(value)

@@ -24,2 +25,4 @@ export const fromNullable = <T>(value: T | null | undefined): Option<T> =>

export const isSome = <T>(o: Option<T>): o is Some<T> => o._tag === 'Some'
const isOption = <T>(o: any): o is Option<T> =>
o._tag === 'None' || o._tag === 'Some'

@@ -54,4 +57,14 @@ export const map =

export const alt =
<T>(v: () => Option<T>) =>
(o: Option<T>): Option<T> =>
isNone(o) ? v() : o
<T>(v: () => Option<T> | T) =>
(o: Option<T>): Option<T> => {
const vv = v()
if (isOption(vv)) return isNone(o) ? vv : o
return isNone(o) ? some(vv) : o
}
export const tap =
<T>(f: (v: T) => void) =>
(o: Option<T>): Option<T> => {
if (isSome(o)) f(o.value)
return o
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc