monocle-ts
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -16,2 +16,12 @@ # Changelog | ||
# 1.2.0 | ||
- **New Feature** | ||
- add `At` (@leighman) | ||
- add `Set` instance | ||
- add `StrMap` instance | ||
- add `Index` (@leighman) | ||
- add `Array` instance | ||
- add `StrMap` instance | ||
# 1.1.0 | ||
@@ -18,0 +28,0 @@ |
@@ -207,2 +207,17 @@ import { HKT, URIS, URIS2, URIS3, Type, Type2, Type3 } from 'fp-ts/lib/HKT'; | ||
} | ||
export declare class At<S, I, A> { | ||
readonly at: (i: I) => Lens<S, A>; | ||
readonly _tag: 'At'; | ||
constructor(at: (i: I) => Lens<S, A>); | ||
/** lift an instance of `At` using an `Iso` */ | ||
fromIso<T>(iso: Iso<T, S>): At<T, I, A>; | ||
} | ||
export declare class Index<S, I, A> { | ||
readonly index: (i: I) => Optional<S, A>; | ||
readonly _tag: 'Index'; | ||
constructor(index: (i: I) => Optional<S, A>); | ||
static fromAt<T, J, B>(at: At<T, J, Option<B>>): Index<T, J, B>; | ||
/** lift an instance of `Index` using an `Iso` */ | ||
fromIso<T>(iso: Iso<T, S>): Index<T, I, A>; | ||
} | ||
export declare class Getter<S, A> { | ||
@@ -209,0 +224,0 @@ readonly get: (s: S) => A; |
@@ -456,2 +456,31 @@ "use strict"; | ||
exports.Traversal = Traversal; | ||
var At = /** @class */ (function () { | ||
function At(at) { | ||
this.at = at; | ||
this._tag = 'At'; | ||
} | ||
/** lift an instance of `At` using an `Iso` */ | ||
At.prototype.fromIso = function (iso) { | ||
var _this = this; | ||
return new At(function (i) { return iso.composeLens(_this.at(i)); }); | ||
}; | ||
return At; | ||
}()); | ||
exports.At = At; | ||
var Index = /** @class */ (function () { | ||
function Index(index) { | ||
this.index = index; | ||
this._tag = 'Index'; | ||
} | ||
Index.fromAt = function (at) { | ||
return new Index(function (i) { return at.at(i).composePrism(Prism.some()); }); | ||
}; | ||
/** lift an instance of `Index` using an `Iso` */ | ||
Index.prototype.fromIso = function (iso) { | ||
var _this = this; | ||
return new Index(function (i) { return iso.composeOptional(_this.index(i)); }); | ||
}; | ||
return Index; | ||
}()); | ||
exports.Index = Index; | ||
var Getter = /** @class */ (function () { | ||
@@ -458,0 +487,0 @@ function Getter(get) { |
{ | ||
"name": "monocle-ts", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "A porting of scala monocle library to TypeScript", | ||
@@ -5,0 +5,0 @@ "files": [ |
@@ -248,2 +248,19 @@ # Motivation | ||
- [fromFoldable](#fromfoldable) | ||
- [At](#at) | ||
- [Methods](#methods-8) | ||
- [fromIso](#fromiso) | ||
- [Instances](#instances) | ||
- [Set](#set) | ||
- [atSet](#atset) | ||
- [StrMap](#strmap) | ||
- [atStrMap](#atstrmap) | ||
- [Index](#index) | ||
- [fromAt](#fromat) | ||
- [Methods](#methods-9) | ||
- [fromIso](#fromiso-1) | ||
- [Instances](#instances-1) | ||
- [Array](#array) | ||
- [indexArray](#indexarray) | ||
- [StrMap](#strmap-1) | ||
- [indexStrMap](#indexstrmap) | ||
@@ -1344,1 +1361,67 @@ <!-- END doctoc generated TOC please keep comment here to allow auto update --> | ||
create a Fold from a Foldable | ||
# At | ||
## Methods | ||
### fromIso | ||
lift an instance of `At` using an `Iso` | ||
```ts | ||
<T>(iso: Iso<T, S>): At<T, I, A> | ||
``` | ||
## Instances | ||
### Set | ||
#### atSet | ||
```ts | ||
<A = never>(setoid: Setoid<A>): At<Set<A>, A, boolean> | ||
``` | ||
### StrMap | ||
#### atStrMap | ||
```ts | ||
<A = never>(): At<SM.StrMap<A>, string, Option<A>> | ||
``` | ||
# Index | ||
## fromAt | ||
```ts | ||
<T, J, B>(at: At<T, J, Option<B>>): Index<T, J, B> | ||
``` | ||
## Methods | ||
### fromIso | ||
lift an instance of `Index` using an `Iso` | ||
```ts | ||
<T>(iso: Iso<T, S>): Index<T, I, A> | ||
``` | ||
## Instances | ||
### Array | ||
#### indexArray | ||
```ts | ||
<A = never>(): Index<Array<A>, number, A> | ||
``` | ||
### StrMap | ||
#### indexStrMap | ||
```ts | ||
<A = never>(): Index<StrMap<A>, string, A> | ||
``` |
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
94189
19
977
1426