monocle-ts
Advanced tools
Comparing version 1.3.0 to 1.4.0
@@ -16,2 +16,7 @@ # Changelog | ||
# 1.4.0 | ||
- **New Feature** | ||
- add `Prism.fromRefinement` (@bepremeg) | ||
# 1.3.0 | ||
@@ -18,0 +23,0 @@ |
@@ -7,3 +7,3 @@ import { HKT, URIS, URIS2, URIS3, Type, Type2, Type3 } from 'fp-ts/lib/HKT'; | ||
import { Option } from 'fp-ts/lib/Option'; | ||
import { Predicate } from 'fp-ts/lib/function'; | ||
import { Predicate, Refinement } from 'fp-ts/lib/function'; | ||
export declare class Iso<S, A> { | ||
@@ -115,2 +115,3 @@ readonly get: (s: S) => A; | ||
static fromPredicate<A>(predicate: Predicate<A>): Prism<A, A>; | ||
static fromRefinement<S, A extends S>(refinement: Refinement<S, A>): Prism<S, A>; | ||
static some<A>(): Prism<Option<A>, A>; | ||
@@ -117,0 +118,0 @@ modify(f: (a: A) => A): (s: S) => S; |
@@ -246,4 +246,7 @@ "use strict"; | ||
Prism.fromPredicate = function (predicate) { | ||
return new Prism(function (s) { return (predicate(s) ? Option_1.some(s) : Option_1.none); }, function (a) { return a; }); | ||
return new Prism(function (s) { return (predicate(s) ? Option_1.some(s) : Option_1.none); }, function_1.identity); | ||
}; | ||
Prism.fromRefinement = function (refinement) { | ||
return new Prism(function (s) { return (refinement(s) ? Option_1.some(s) : Option_1.none); }, function_1.identity); | ||
}; | ||
Prism.some = function () { | ||
@@ -250,0 +253,0 @@ return somePrism; |
{ | ||
"name": "monocle-ts", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "A porting of scala monocle library to TypeScript", | ||
@@ -5,0 +5,0 @@ "files": [ |
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
71620
1000