Comparing version 1.4.0 to 1.4.1
@@ -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-0ed56d5d.js'; | ||
export { o as Opt } from './opt-2faa0ef3.js'; | ||
import './types.js'; |
@@ -213,2 +213,3 @@ "use strict"; | ||
__export(opt_exports, { | ||
filter: () => filter3, | ||
flatMap: () => flatMap, | ||
@@ -229,3 +230,3 @@ from: () => from3, | ||
}); | ||
var none = { _tag: "None" }, some2 = (value) => ({ _tag: "Some", value }), from3 = (value) => some2(value), fromNullable = (value) => value == null ? none : some2(value), fromExecution = (value) => { | ||
var none = Object.freeze({ _tag: "None" }), some2 = (value) => Object.freeze({ _tag: "Some", value }), from3 = (value) => some2(value), fromNullable = (value) => value == null ? none : some2(value), fromExecution = (value) => { | ||
try { | ||
@@ -243,3 +244,3 @@ return fromNullable(value()); | ||
return isOption(vv) ? isNone(o) ? vv : o : isNone(o) ? some2(vv) : o; | ||
}, tap2 = (f) => (o) => (isSome(o) && f(o.value), o); | ||
}, tap2 = (f) => (o) => (isSome(o) && f(o.value), o), filter3 = (f) => (o) => isNone(o) ? none : f(o.value) ? o : none; | ||
// Annotate the CommonJS export names for ESM import in node: | ||
@@ -246,0 +247,0 @@ 0 && (module.exports = { |
@@ -1,1 +0,1 @@ | ||
export { 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, j as orElse, s as some, t as tap } from './opt-0ed56d5d.js'; | ||
export { k as filter, 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, j as orElse, s as some, t as tap } from './opt-2faa0ef3.js'; |
@@ -20,2 +20,3 @@ "use strict"; | ||
__export(opt_exports, { | ||
filter: () => filter, | ||
flatMap: () => flatMap, | ||
@@ -37,3 +38,3 @@ from: () => from, | ||
module.exports = __toCommonJS(opt_exports); | ||
var none = { _tag: "None" }, some = (value) => ({ _tag: "Some", value }), from = (value) => some(value), fromNullable = (value) => value == null ? none : some(value), fromExecution = (value) => { | ||
var none = Object.freeze({ _tag: "None" }), some = (value) => Object.freeze({ _tag: "Some", value }), from = (value) => some(value), fromNullable = (value) => value == null ? none : some(value), fromExecution = (value) => { | ||
try { | ||
@@ -51,5 +52,6 @@ return fromNullable(value()); | ||
return isOption(vv) ? isNone(o) ? vv : o : isNone(o) ? some(vv) : o; | ||
}, tap = (f) => (o) => (isSome(o) && f(o.value), o); | ||
}, tap = (f) => (o) => (isSome(o) && f(o.value), o), filter = (f) => (o) => isNone(o) ? none : f(o.value) ? o : none; | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
filter, | ||
flatMap, | ||
@@ -56,0 +58,0 @@ from, |
{ | ||
"name": "lil-fp", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"description": "Functional programming utilities for TypeScript", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -5,4 +5,6 @@ type Option<T> = None | Some<T> | ||
export const none: Option<never> = { _tag: 'None' } | ||
export const some = <T>(value: T): Option<T> => ({ _tag: 'Some', value }) | ||
export const none: Option<never> = Object.freeze({ _tag: 'None' }) | ||
export const some = <T>(value: T): Option<T> => | ||
Object.freeze({ _tag: 'Some', value }) | ||
export const from = <T>(value: T): Option<T> => some(value) | ||
@@ -69,1 +71,6 @@ | ||
} | ||
export const filter = | ||
<T>(f: (v: T) => boolean) => | ||
(o: Option<T>): Option<T> => | ||
isNone(o) ? none : f(o.value) ? o : none |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
76436
2219