monocle-ts
Advanced tools
Comparing version 1.5.0 to 1.5.1
@@ -16,2 +16,7 @@ # Changelog | ||
# 1.5.1 | ||
- **Polish** | ||
- add aliases for `compose` methods, closes #51 (@gcanti) | ||
# 1.5.0 | ||
@@ -18,0 +23,0 @@ |
@@ -12,2 +12,6 @@ import { HKT, URIS, URIS2, URIS3, Type, Type2, Type3 } from 'fp-ts/lib/HKT'; | ||
readonly _tag: 'Iso'; | ||
readonly unwrap: (s: S) => A; | ||
readonly to: (s: S) => A; | ||
readonly wrap: (a: A) => S; | ||
readonly from: (a: A) => S; | ||
constructor(get: (s: S) => A, reverseGet: (a: A) => S); | ||
@@ -33,2 +37,4 @@ /** reverse the `Iso`: the source becomes the target and the target becomes the source */ | ||
compose<B>(ab: Iso<A, B>): Iso<S, B>; | ||
/** @alias of `compose` */ | ||
composeIso<B>(ab: Iso<A, B>): Iso<S, B>; | ||
/** compose an Iso with a Lens */ | ||
@@ -49,8 +55,2 @@ composeLens<B>(ab: Lens<A, B>): Lens<S, B>; | ||
} | ||
export interface Iso<S, A> { | ||
unwrap: (s: S) => A; | ||
to: (s: S) => A; | ||
wrap: (a: A) => S; | ||
from: (a: A) => S; | ||
} | ||
export interface LensFromPath<S> { | ||
@@ -96,2 +96,4 @@ <K1 extends keyof S, K2 extends keyof S[K1], K3 extends keyof S[K1][K2], K4 extends keyof S[K1][K2][K3], K5 extends keyof S[K1][K2][K3][K4]>(path: [K1, K2, K3, K4, K5]): Lens<S, S[K1][K2][K3][K4][K5]>; | ||
compose<B>(ab: Lens<A, B>): Lens<S, B>; | ||
/** @alias of `compose` */ | ||
composeLens<B>(ab: Lens<A, B>): Lens<S, B>; | ||
/** compose a Lens with a Getter */ | ||
@@ -134,2 +136,4 @@ composeGetter<B>(ab: Getter<A, B>): Getter<S, B>; | ||
compose<B>(ab: Prism<A, B>): Prism<S, B>; | ||
/** @alias of `compose` */ | ||
composePrism<B>(ab: Prism<A, B>): Prism<S, B>; | ||
/** compose a Prism with a Optional */ | ||
@@ -173,2 +177,4 @@ composeOptional<B>(ab: Optional<A, B>): Optional<S, B>; | ||
compose<B>(ab: Optional<A, B>): Optional<S, B>; | ||
/** @alias of `compose` */ | ||
composeOptional<B>(ab: Optional<A, B>): Optional<S, B>; | ||
/** compose an Optional with a Traversal */ | ||
@@ -209,2 +215,4 @@ composeTraversal<B>(ab: Traversal<A, B>): Traversal<S, B>; | ||
compose<B>(ab: Traversal<A, B>): Traversal<S, B>; | ||
/** @alias of `compose` */ | ||
composeTraversal<B>(ab: Traversal<A, B>): Traversal<S, B>; | ||
/** compose a Traversal with a Fold */ | ||
@@ -248,2 +256,4 @@ composeFold<B>(ab: Fold<A, B>): Fold<S, B>; | ||
compose<B>(ab: Getter<A, B>): Getter<S, B>; | ||
/** @alias of `compose` */ | ||
composeGetter<B>(ab: Getter<A, B>): Getter<S, B>; | ||
/** compose a Getter with a Fold */ | ||
@@ -265,2 +275,8 @@ composeFold<B>(ab: Fold<A, B>): Fold<S, B>; | ||
readonly _tag: 'Fold'; | ||
/** get all the targets of a Fold */ | ||
readonly getAll: (s: S) => Array<A>; | ||
/** check if at least one target satisfies the predicate */ | ||
readonly exist: (p: Predicate<A>) => Predicate<S>; | ||
/** check if all targets satisfy the predicate */ | ||
readonly all: (p: Predicate<A>) => Predicate<S>; | ||
private foldMapFirst; | ||
@@ -270,2 +286,4 @@ constructor(foldMap: <M>(M: Monoid<M>) => (f: (a: A) => M) => (s: S) => M); | ||
compose<B>(ab: Fold<A, B>): Fold<S, B>; | ||
/** @alias of `compose` */ | ||
composeFold<B>(ab: Fold<A, B>): Fold<S, B>; | ||
/** compose a Fold with a Getter */ | ||
@@ -288,10 +306,2 @@ composeGetter<B>(ab: Getter<A, B>): Fold<S, B>; | ||
} | ||
export interface Fold<S, A> { | ||
/** get all the targets of a Fold */ | ||
getAll(s: S): Array<A>; | ||
/** check if at least one target satisfies the predicate */ | ||
exist(p: Predicate<A>): Predicate<S>; | ||
/** check if all targets satisfy the predicate */ | ||
all(p: Predicate<A>): Predicate<S>; | ||
} | ||
export declare class Setter<S, A> { | ||
@@ -304,2 +314,4 @@ readonly modify: (f: (a: A) => A) => (s: S) => S; | ||
compose<B>(ab: Setter<A, B>): Setter<S, B>; | ||
/** @alias of `compose` */ | ||
composeSetter<B>(ab: Setter<A, B>): Setter<S, B>; | ||
/** compose a Setter with a Traversal */ | ||
@@ -306,0 +318,0 @@ composeTraversal<B>(ab: Traversal<A, B>): Setter<S, B>; |
@@ -30,4 +30,6 @@ "use strict"; | ||
this._tag = 'Iso'; | ||
this.unwrap = this.to = get; | ||
this.wrap = this.from = reverseGet; | ||
this.unwrap = this.get; | ||
this.to = this.get; | ||
this.wrap = this.reverseGet; | ||
this.from = this.reverseGet; | ||
} | ||
@@ -84,2 +86,6 @@ /** reverse the `Iso`: the source becomes the target and the target becomes the source */ | ||
}; | ||
/** @alias of `compose` */ | ||
Iso.prototype.composeIso = function (ab) { | ||
return this.compose(ab); | ||
}; | ||
/** compose an Iso with a Lens */ | ||
@@ -205,2 +211,6 @@ Iso.prototype.composeLens = function (ab) { | ||
}; | ||
/** @alias of `compose` */ | ||
Lens.prototype.composeLens = function (ab) { | ||
return this.compose(ab); | ||
}; | ||
/** compose a Lens with a Getter */ | ||
@@ -296,2 +306,6 @@ Lens.prototype.composeGetter = function (ab) { | ||
}; | ||
/** @alias of `compose` */ | ||
Prism.prototype.composePrism = function (ab) { | ||
return this.compose(ab); | ||
}; | ||
/** compose a Prism with a Optional */ | ||
@@ -386,2 +400,6 @@ Prism.prototype.composeOptional = function (ab) { | ||
}; | ||
/** @alias of `compose` */ | ||
Optional.prototype.composeOptional = function (ab) { | ||
return this.compose(ab); | ||
}; | ||
/** compose an Optional with a Traversal */ | ||
@@ -452,2 +470,6 @@ Optional.prototype.composeTraversal = function (ab) { | ||
}; | ||
/** @alias of `compose` */ | ||
Traversal.prototype.composeTraversal = function (ab) { | ||
return this.compose(ab); | ||
}; | ||
/** compose a Traversal with a Fold */ | ||
@@ -528,2 +550,6 @@ Traversal.prototype.composeFold = function (ab) { | ||
}; | ||
/** @alias of `compose` */ | ||
Getter.prototype.composeGetter = function (ab) { | ||
return this.compose(ab); | ||
}; | ||
/** compose a Getter with a Fold */ | ||
@@ -570,2 +596,6 @@ Getter.prototype.composeFold = function (ab) { | ||
}; | ||
/** @alias of `compose` */ | ||
Fold.prototype.composeFold = function (ab) { | ||
return this.compose(ab); | ||
}; | ||
/** compose a Fold with a Getter */ | ||
@@ -620,2 +650,6 @@ Fold.prototype.composeGetter = function (ab) { | ||
}; | ||
/** @alias of `compose` */ | ||
Setter.prototype.composeSetter = function (ab) { | ||
return this.compose(ab); | ||
}; | ||
/** compose a Setter with a Traversal */ | ||
@@ -622,0 +656,0 @@ Setter.prototype.composeTraversal = function (ab) { |
{ | ||
"name": "monocle-ts", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"description": "A porting of scala monocle library to TypeScript", | ||
@@ -13,2 +13,3 @@ "files": [ | ||
"jest": "jest", | ||
"jest-coverage": "jest --ci --coverage", | ||
"prettier": "prettier --no-semi --single-quote --print-width 120 --parser typescript --list-different \"{src,test,examples}/**/*.ts\"", | ||
@@ -41,3 +42,3 @@ "fix-prettier": "prettier --no-semi --single-quote --print-width 120 --parser typescript --write \"{src,test,examples}/**/*.ts\"", | ||
"doctoc": "1.3.0", | ||
"dtslint": "^0.3.0", | ||
"dtslint": "^0.4.1", | ||
"jest": "^23.5.0", | ||
@@ -44,0 +45,0 @@ "prettier": "^1.13.5", |
@@ -151,2 +151,3 @@ [![build status](https://img.shields.io/travis/gcanti/monocle-ts/master.svg?style=flat-square)](https://travis-ci.org/gcanti/monocle-ts) | ||
- [compose](#compose) | ||
- [composeIso](#composeiso) | ||
- [composeLens](#composelens) | ||
@@ -172,2 +173,3 @@ - [composePrism](#composeprism) | ||
- [compose](#compose-1) | ||
- [composeLens](#composelens-1) | ||
- [composeGetter](#composegetter-1) | ||
@@ -178,3 +180,3 @@ - [composeFold](#composefold-1) | ||
- [composeSetter](#composesetter-1) | ||
- [composeIso](#composeiso) | ||
- [composeIso](#composeiso-1) | ||
- [composePrism](#composeprism-1) | ||
@@ -193,2 +195,3 @@ - [Prism](#prism) | ||
- [compose](#compose-2) | ||
- [composePrism](#composeprism-2) | ||
- [composeOptional](#composeoptional-2) | ||
@@ -198,4 +201,4 @@ - [composeTraversal](#composetraversal-2) | ||
- [composeSetter](#composesetter-2) | ||
- [composeIso](#composeiso-1) | ||
- [composeLens](#composelens-1) | ||
- [composeIso](#composeiso-2) | ||
- [composeLens](#composelens-2) | ||
- [composeGetter](#composegetter-2) | ||
@@ -212,8 +215,9 @@ - [Optional](#optional) | ||
- [compose](#compose-3) | ||
- [composeOptional](#composeoptional-3) | ||
- [composeTraversal](#composetraversal-3) | ||
- [composeFold](#composefold-3) | ||
- [composeSetter](#composesetter-3) | ||
- [composeLens](#composelens-2) | ||
- [composePrism](#composeprism-2) | ||
- [composeIso](#composeiso-2) | ||
- [composeLens](#composelens-3) | ||
- [composePrism](#composeprism-3) | ||
- [composeIso](#composeiso-3) | ||
- [composeGetter](#composegetter-3) | ||
@@ -227,8 +231,9 @@ - [Traversal](#traversal) | ||
- [compose](#compose-4) | ||
- [composeTraversal](#composetraversal-4) | ||
- [composeFold](#composefold-4) | ||
- [composeSetter](#composesetter-4) | ||
- [composeOptional](#composeoptional-3) | ||
- [composeLens](#composelens-3) | ||
- [composePrism](#composeprism-3) | ||
- [composeIso](#composeiso-3) | ||
- [composeOptional](#composeoptional-4) | ||
- [composeLens](#composelens-4) | ||
- [composePrism](#composeprism-4) | ||
- [composeIso](#composeiso-4) | ||
- [composeGetter](#composegetter-4) | ||
@@ -239,17 +244,19 @@ - [Getter](#getter) | ||
- [compose](#compose-5) | ||
- [composeGetter](#composegetter-5) | ||
- [composeFold](#composefold-5) | ||
- [composeLens](#composelens-4) | ||
- [composeIso](#composeiso-4) | ||
- [composeTraversal](#composetraversal-4) | ||
- [composeOptional](#composeoptional-4) | ||
- [composePrism](#composeprism-4) | ||
- [composeLens](#composelens-5) | ||
- [composeIso](#composeiso-5) | ||
- [composeTraversal](#composetraversal-5) | ||
- [composeOptional](#composeoptional-5) | ||
- [composePrism](#composeprism-5) | ||
- [Fold](#fold) | ||
- [Methods](#methods-6) | ||
- [compose](#compose-6) | ||
- [composeGetter](#composegetter-5) | ||
- [composeTraversal](#composetraversal-5) | ||
- [composeOptional](#composeoptional-5) | ||
- [composeLens](#composelens-5) | ||
- [composePrism](#composeprism-5) | ||
- [composeIso](#composeiso-5) | ||
- [composeFold](#composefold-6) | ||
- [composeGetter](#composegetter-6) | ||
- [composeTraversal](#composetraversal-6) | ||
- [composeOptional](#composeoptional-6) | ||
- [composeLens](#composelens-6) | ||
- [composePrism](#composeprism-6) | ||
- [composeIso](#composeiso-6) | ||
- [find](#find) | ||
@@ -264,7 +271,8 @@ - [headOption](#headoption) | ||
- [compose](#compose-7) | ||
- [composeTraversal](#composetraversal-6) | ||
- [composeOptional](#composeoptional-6) | ||
- [composeLens](#composelens-6) | ||
- [composePrism](#composeprism-6) | ||
- [composeIso](#composeiso-6) | ||
- [composeSetter](#composesetter-5) | ||
- [composeTraversal](#composetraversal-7) | ||
- [composeOptional](#composeoptional-7) | ||
- [composeLens](#composelens-7) | ||
- [composePrism](#composeprism-7) | ||
- [composeIso](#composeiso-7) | ||
- [fromTraversable](#fromtraversable) | ||
@@ -414,2 +422,6 @@ - [fromFoldable](#fromfoldable) | ||
### composeIso | ||
Alias of `compose` | ||
### composeLens | ||
@@ -647,2 +659,6 @@ | ||
### composeLens | ||
Alias of `compose` | ||
### composeGetter | ||
@@ -786,2 +802,6 @@ | ||
### composePrism | ||
Alias of `compose` | ||
### composeOptional | ||
@@ -982,2 +1002,6 @@ | ||
### composeOptional | ||
Alias of `compose` | ||
### composeTraversal | ||
@@ -1091,2 +1115,6 @@ | ||
### composeTraversal | ||
Alias of `compose` | ||
### composeFold | ||
@@ -1174,2 +1202,6 @@ | ||
### composeGetter | ||
Alias of `compose` | ||
### composeFold | ||
@@ -1241,2 +1273,6 @@ | ||
### composeFold | ||
Alias of `compose` | ||
### composeGetter | ||
@@ -1354,2 +1390,6 @@ | ||
### composeSetter | ||
Alias of `compose` | ||
### composeTraversal | ||
@@ -1356,0 +1396,0 @@ |
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
76796
1069
1539