monocle-ts
Advanced tools
Comparing version 2.3.2 to 2.3.3
@@ -16,2 +16,13 @@ # Changelog | ||
# 2.3.3 | ||
- **Experimental** | ||
- `Prism` | ||
- (\*) remove `fromSome` constructor (@gcanti) | ||
- (\*) change `fromNullable` signature (@gcanti) | ||
- `Optional` | ||
- add missing `fromNullable` combinator, closes #133 (@gcanti) | ||
(\*) breaking change | ||
# 2.3.2 | ||
@@ -18,0 +29,0 @@ |
@@ -87,3 +87,3 @@ /** | ||
* | ||
* @category constructors | ||
* @category combinators | ||
* @since 2.3.0 | ||
@@ -90,0 +90,0 @@ */ |
@@ -70,3 +70,3 @@ import { flow } from 'fp-ts/es6/function'; | ||
* | ||
* @category constructors | ||
* @category combinators | ||
* @since 2.3.0 | ||
@@ -73,0 +73,0 @@ */ |
@@ -69,3 +69,10 @@ /** | ||
/** | ||
* Return an `Optional` from a `Optional` focused on a nullable value | ||
* | ||
* @category combinators | ||
* @since 2.3.3 | ||
*/ | ||
export declare const fromNullable: <S, A>(sa: Optional<S, A>) => Optional<S, NonNullable<A>> | ||
/** | ||
* @category combinators | ||
* @since 2.3.0 | ||
@@ -72,0 +79,0 @@ */ |
@@ -49,2 +49,11 @@ import { constant, flow } from 'fp-ts/es6/function'; | ||
export var modify = _.optionalModify; | ||
/** | ||
* Return an `Optional` from a `Optional` focused on a nullable value | ||
* | ||
* @category combinators | ||
* @since 2.3.3 | ||
*/ | ||
export var fromNullable = | ||
/*#__PURE__*/ | ||
compose(_.prismAsOptional(_.prismFromNullable())); | ||
export function filter(predicate) { | ||
@@ -51,0 +60,0 @@ return compose(_.prismAsOptional(_.prismFromPredicate(predicate))); |
@@ -50,12 +50,2 @@ /** | ||
/** | ||
* @category constructors | ||
* @since 2.3.0 | ||
*/ | ||
export declare const fromSome: <A>() => Prism<Option<A>, A> | ||
/** | ||
* @category constructors | ||
* @since 2.3.0 | ||
*/ | ||
export declare const fromNullable: <A>() => Prism<A, NonNullable<A>> | ||
/** | ||
* View a `Prism` as a `Optional` | ||
@@ -99,2 +89,7 @@ * | ||
*/ | ||
export declare const set: <A>(a: A) => <S>(sa: Prism<S, A>) => (s: S) => S | ||
/** | ||
* @category combinators | ||
* @since 2.3.0 | ||
*/ | ||
export declare const modifyOption: <A>(f: (a: A) => A) => <S>(sa: Prism<S, A>) => (s: S) => Option<S> | ||
@@ -107,6 +102,8 @@ /** | ||
/** | ||
* Return a `Prism` from a `Prism` focused on a nullable value | ||
* | ||
* @category combinators | ||
* @since 2.3.0 | ||
* @since 2.3.3 | ||
*/ | ||
export declare const set: <A>(a: A) => <S>(sa: Prism<S, A>) => (s: S) => S | ||
export declare const fromNullable: <S, A>(sa: Prism<S, A>) => Prism<S, NonNullable<A>> | ||
/** | ||
@@ -113,0 +110,0 @@ * @category combinators |
@@ -21,12 +21,2 @@ import { flow, identity } from 'fp-ts/es6/function'; | ||
export var fromPredicate = _.prismFromPredicate; | ||
/** | ||
* @category constructors | ||
* @since 2.3.0 | ||
*/ | ||
export var fromSome = _.prismSome; | ||
/** | ||
* @category constructors | ||
* @since 2.3.0 | ||
*/ | ||
export var fromNullable = _.prismFromNullable; | ||
// ------------------------------------------------------------------------------------- | ||
@@ -85,2 +75,7 @@ // converters | ||
*/ | ||
export var set = _.prismSet; | ||
/** | ||
* @category combinators | ||
* @since 2.3.0 | ||
*/ | ||
export var modifyOption = _.prismModifyOption; | ||
@@ -93,6 +88,10 @@ /** | ||
/** | ||
* Return a `Prism` from a `Prism` focused on a nullable value | ||
* | ||
* @category combinators | ||
* @since 2.3.0 | ||
* @since 2.3.3 | ||
*/ | ||
export var set = _.prismSet; | ||
export var fromNullable = | ||
/*#__PURE__*/ | ||
compose(_.prismFromNullable()); | ||
export function filter(predicate) { | ||
@@ -99,0 +98,0 @@ return compose(_.prismFromPredicate(predicate)); |
@@ -87,3 +87,3 @@ /** | ||
* | ||
* @category constructors | ||
* @category combinators | ||
* @since 2.3.0 | ||
@@ -90,0 +90,0 @@ */ |
@@ -73,3 +73,3 @@ "use strict"; | ||
* | ||
* @category constructors | ||
* @category combinators | ||
* @since 2.3.0 | ||
@@ -76,0 +76,0 @@ */ |
@@ -69,3 +69,10 @@ /** | ||
/** | ||
* Return an `Optional` from a `Optional` focused on a nullable value | ||
* | ||
* @category combinators | ||
* @since 2.3.3 | ||
*/ | ||
export declare const fromNullable: <S, A>(sa: Optional<S, A>) => Optional<S, NonNullable<A>> | ||
/** | ||
* @category combinators | ||
* @since 2.3.0 | ||
@@ -72,0 +79,0 @@ */ |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.categoryOptional = exports.invariantOptional = exports.URI = exports.imap = exports.findFirst = exports.traverse = exports.left = exports.right = exports.some = exports.atKey = exports.key = exports.index = exports.component = exports.props = exports.prop = exports.filter = exports.modify = exports.modifyOption = exports.compose = exports.asTraversal = exports.id = void 0; | ||
exports.categoryOptional = exports.invariantOptional = exports.URI = exports.imap = exports.findFirst = exports.traverse = exports.left = exports.right = exports.some = exports.atKey = exports.key = exports.index = exports.component = exports.props = exports.prop = exports.filter = exports.fromNullable = exports.modify = exports.modifyOption = exports.compose = exports.asTraversal = exports.id = void 0; | ||
var function_1 = require("fp-ts/lib/function"); | ||
@@ -52,2 +52,11 @@ var O = require("fp-ts/lib/Option"); | ||
exports.modify = _.optionalModify; | ||
/** | ||
* Return an `Optional` from a `Optional` focused on a nullable value | ||
* | ||
* @category combinators | ||
* @since 2.3.3 | ||
*/ | ||
exports.fromNullable = | ||
/*#__PURE__*/ | ||
exports.compose(_.prismAsOptional(_.prismFromNullable())); | ||
function filter(predicate) { | ||
@@ -54,0 +63,0 @@ return exports.compose(_.prismAsOptional(_.prismFromPredicate(predicate))); |
@@ -50,12 +50,2 @@ /** | ||
/** | ||
* @category constructors | ||
* @since 2.3.0 | ||
*/ | ||
export declare const fromSome: <A>() => Prism<Option<A>, A> | ||
/** | ||
* @category constructors | ||
* @since 2.3.0 | ||
*/ | ||
export declare const fromNullable: <A>() => Prism<A, NonNullable<A>> | ||
/** | ||
* View a `Prism` as a `Optional` | ||
@@ -99,2 +89,7 @@ * | ||
*/ | ||
export declare const set: <A>(a: A) => <S>(sa: Prism<S, A>) => (s: S) => S | ||
/** | ||
* @category combinators | ||
* @since 2.3.0 | ||
*/ | ||
export declare const modifyOption: <A>(f: (a: A) => A) => <S>(sa: Prism<S, A>) => (s: S) => Option<S> | ||
@@ -107,6 +102,8 @@ /** | ||
/** | ||
* Return a `Prism` from a `Prism` focused on a nullable value | ||
* | ||
* @category combinators | ||
* @since 2.3.0 | ||
* @since 2.3.3 | ||
*/ | ||
export declare const set: <A>(a: A) => <S>(sa: Prism<S, A>) => (s: S) => S | ||
export declare const fromNullable: <S, A>(sa: Prism<S, A>) => Prism<S, NonNullable<A>> | ||
/** | ||
@@ -113,0 +110,0 @@ * @category combinators |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.categoryPrism = exports.invariantPrism = exports.URI = exports.imap = exports.findFirst = exports.traverse = exports.left = exports.right = exports.some = exports.atKey = exports.key = exports.index = exports.component = exports.props = exports.prop = exports.filter = exports.set = exports.modify = exports.modifyOption = exports.composeOptional = exports.composeLens = exports.compose = exports.asTraversal = exports.asOptional = exports.fromNullable = exports.fromSome = exports.fromPredicate = exports.id = void 0; | ||
exports.categoryPrism = exports.invariantPrism = exports.URI = exports.imap = exports.findFirst = exports.traverse = exports.left = exports.right = exports.some = exports.atKey = exports.key = exports.index = exports.component = exports.props = exports.prop = exports.filter = exports.fromNullable = exports.modify = exports.modifyOption = exports.set = exports.composeOptional = exports.composeLens = exports.compose = exports.asTraversal = exports.asOptional = exports.fromPredicate = exports.id = void 0; | ||
var function_1 = require("fp-ts/lib/function"); | ||
@@ -24,12 +24,2 @@ var O = require("fp-ts/lib/Option"); | ||
exports.fromPredicate = _.prismFromPredicate; | ||
/** | ||
* @category constructors | ||
* @since 2.3.0 | ||
*/ | ||
exports.fromSome = _.prismSome; | ||
/** | ||
* @category constructors | ||
* @since 2.3.0 | ||
*/ | ||
exports.fromNullable = _.prismFromNullable; | ||
// ------------------------------------------------------------------------------------- | ||
@@ -88,2 +78,7 @@ // converters | ||
*/ | ||
exports.set = _.prismSet; | ||
/** | ||
* @category combinators | ||
* @since 2.3.0 | ||
*/ | ||
exports.modifyOption = _.prismModifyOption; | ||
@@ -96,6 +91,10 @@ /** | ||
/** | ||
* Return a `Prism` from a `Prism` focused on a nullable value | ||
* | ||
* @category combinators | ||
* @since 2.3.0 | ||
* @since 2.3.3 | ||
*/ | ||
exports.set = _.prismSet; | ||
exports.fromNullable = | ||
/*#__PURE__*/ | ||
exports.compose(_.prismFromNullable()); | ||
function filter(predicate) { | ||
@@ -102,0 +101,0 @@ return exports.compose(_.prismFromPredicate(predicate)); |
{ | ||
"name": "monocle-ts", | ||
"version": "2.3.2", | ||
"version": "2.3.3", | ||
"description": "A porting of scala monocle library to TypeScript", | ||
@@ -5,0 +5,0 @@ "files": [ |
285267
10099