Socket
Socket
Sign inDemoInstall

monocle-ts

Package Overview
Dependencies
1
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.5.2 to 0.5.3-rc

30

lib/index.d.ts

@@ -1,6 +0,6 @@

import { HKT, HKTS, HKTAs, HKT2S, HKT2As } from 'fp-ts/lib/HKT';
import { HKT, URIS, URIS2, URIS3, Type, Type2, Type3 } from 'fp-ts/lib/HKT';
import { Monoid } from 'fp-ts/lib/Monoid';
import { Applicative } from 'fp-ts/lib/Applicative';
import { Foldable } from 'fp-ts/lib/Foldable';
import { Traversable } from 'fp-ts/lib/Traversable';
import { Applicative, Applicative1, Applicative2, Applicative3, Applicative2C, Applicative3C } from 'fp-ts/lib/Applicative';
import { Foldable, Foldable1, Foldable2, Foldable3 } from 'fp-ts/lib/Foldable';
import { Traversable, Traversable1, Traversable2, Traversable3 } from 'fp-ts/lib/Traversable';
import { Option } from 'fp-ts/lib/Option';

@@ -168,6 +168,14 @@ import { Predicate } from 'fp-ts/lib/function';

}
export interface ModifyF<S, A> {
<F extends URIS3>(F: Applicative3<F>): <U, L>(f: (a: A) => Type3<F, U, L, A>) => (s: S) => Type3<F, U, L, S>;
<F extends URIS3, U, L>(F: Applicative3C<F, U, L>): (f: (a: A) => Type3<F, U, L, A>) => (s: S) => Type3<F, U, L, S>;
<F extends URIS2>(F: Applicative2<F>): <L>(f: (a: A) => Type2<F, L, A>) => (s: S) => Type2<F, L, S>;
<F extends URIS2, L>(F: Applicative2C<F, L>): (f: (a: A) => Type2<F, L, A>) => (s: S) => Type2<F, L, S>;
<F extends URIS>(F: Applicative1<F>): (f: (a: A) => Type<F, A>) => (s: S) => Type<F, S>;
<F>(F: Applicative<F>): (f: (a: A) => HKT<F, A>) => (s: S) => HKT<F, S>;
}
export declare class Traversal<S, A> {
readonly modifyF: <F>(F: Applicative<F>) => (f: (a: A) => HKT<F, A>) => (s: S) => HKT<F, S>;
readonly modifyF: ModifyF<S, A>;
readonly _tag: 'Traversal';
constructor(modifyF: <F>(F: Applicative<F>) => (f: (a: A) => HKT<F, A>) => (s: S) => HKT<F, S>);
constructor(modifyF: ModifyF<S, A>);
modify(f: (a: A) => A): (s: S) => S;

@@ -268,8 +276,10 @@ set(a: A): (s: S) => S;

/** create a Traversal from a Traversable */
export declare function fromTraversable<T extends HKT2S>(T: Traversable<T>): <L, A>() => Traversal<HKT2As<T, L, A>, A>;
export declare function fromTraversable<T extends HKTS>(T: Traversable<T>): <A>() => Traversal<HKTAs<T, A>, A>;
export declare function fromTraversable<T extends URIS3>(T: Traversable3<T>): <U, L, A>() => Traversal<Type3<T, U, L, A>, A>;
export declare function fromTraversable<T extends URIS2>(T: Traversable2<T>): <L, A>() => Traversal<Type2<T, L, A>, A>;
export declare function fromTraversable<T extends URIS>(T: Traversable1<T>): <A>() => Traversal<Type<T, A>, A>;
export declare function fromTraversable<T>(T: Traversable<T>): <A>() => Traversal<HKT<T, A>, A>;
/** create a Fold from a Foldable */
export declare function fromFoldable<F extends HKT2S>(F: Foldable<F>): <L, A>() => Fold<HKT2As<F, L, A>, A>;
export declare function fromFoldable<F extends HKTS>(F: Foldable<F>): <A>() => Fold<HKTAs<F, A>, A>;
export declare function fromFoldable<F extends URIS3>(F: Foldable3<F>): <U, L, A>() => Fold<Type3<F, U, L, A>, A>;
export declare function fromFoldable<F extends URIS2>(F: Foldable2<F>): <L, A>() => Fold<Type2<F, L, A>, A>;
export declare function fromFoldable<F extends URIS>(F: Foldable1<F>): <A>() => Fold<Type<F, A>, A>;
export declare function fromFoldable<F>(F: Foldable<F>): <A>() => Fold<HKT<F, A>, A>;

@@ -13,7 +13,6 @@ "use strict";

var Foldable_1 = require("fp-ts/lib/Foldable");
var option = require("fp-ts/lib/Option");
var Option_1 = require("fp-ts/lib/Option");
var function_1 = require("fp-ts/lib/function");
var id = require("fp-ts/lib/Identity");
var const_ = require("fp-ts/lib/Const");
var Identity_1 = require("fp-ts/lib/Identity");
var Const_1 = require("fp-ts/lib/Const");
/*

@@ -59,3 +58,3 @@ Laws:

return new Traversal(function (F) { return function (f) { return function (s) {
return F.map(function (a) { return _this.reverseGet(a); }, f(_this.get(s)));
return F.map(f(_this.get(s)), function (a) { return _this.reverseGet(a); });
}; }; });

@@ -140,3 +139,3 @@ };

Lens.fromNullableProp = function (k, defaultValue) {
return new Lens(function (s) { return Option_1.fromNullable(s[k]).getOrElseValue(defaultValue); }, function (a) { return function (s) {
return new Lens(function (s) { return Option_1.fromNullable(s[k]).getOrElse(defaultValue); }, function (a) { return function (s) {
return (__assign({}, s, (_a = {}, _a[k] = a, _a)));

@@ -159,3 +158,3 @@ var _a;

return new Traversal(function (F) { return function (f) { return function (s) {
return F.map(function (a) { return _this.set(a)(s); }, f(_this.get(s)));
return F.map(f(_this.get(s)), function (a) { return _this.set(a)(s); });
}; }; });

@@ -234,3 +233,3 @@ };

var _this = this;
return function (s) { return _this.modifyOption(f)(s).fold(function_1.constant(s), function_1.identity); };
return function (s) { return _this.modifyOption(f)(s).fold(s, function_1.identity); };
};

@@ -254,3 +253,3 @@ Prism.prototype.modifyOption = function (f) {

return new Traversal(function (F) { return function (f) { return function (s) {
return _this.getOption(s).fold(function () { return F.of(s); }, function (a) { return F.map(function (a) { return _this.set(a)(s); }, f(a)); });
return _this.getOption(s).foldL(function () { return F.of(s); }, function (a) { return F.map(f(a), function (a) { return _this.set(a)(s); }); });
}; }; });

@@ -266,3 +265,3 @@ };

var _this = this;
return new Fold(function (M) { return function (f) { return function (s) { return _this.getOption(s).fold(function () { return M.empty(); }, f); }; }; });
return new Fold(function (M) { return function (f) { return function (s) { return _this.getOption(s).fold(M.empty, f); }; }; });
};

@@ -320,3 +319,3 @@ /** compose a Prism with a Prism */

var _this = this;
return function (s) { return _this.modifyOption(f)(s).fold(function_1.constant(s), function_1.identity); };
return function (s) { return _this.modifyOption(f)(s).fold(s, function_1.identity); };
};

@@ -331,3 +330,3 @@ Optional.prototype.modifyOption = function (f) {

return new Traversal(function (F) { return function (f) { return function (s) {
return _this.getOption(s).fold(function () { return F.of(s); }, function (a) { return F.map(function (a) { return _this.set(a)(s); }, f(a)); });
return _this.getOption(s).foldL(function () { return F.of(s); }, function (a) { return F.map(f(a), function (a) { return _this.set(a)(s); }); });
}; }; });

@@ -338,3 +337,3 @@ };

var _this = this;
return new Fold(function (M) { return function (f) { return function (s) { return _this.getOption(s).fold(function () { return M.empty(); }, f); }; }; });
return new Fold(function (M) { return function (f) { return function (s) { return _this.getOption(s).fold(M.empty, f); }; }; });
};

@@ -390,4 +389,4 @@ /** view an Optional as a Setter */

function Traversal(
// Van Laarhoven representation
modifyF) {
// Van Laarhoven representation
modifyF) {
this.modifyF = modifyF;

@@ -398,3 +397,3 @@ this._tag = 'Traversal';

var _this = this;
return function (s) { return _this.modifyF(id)(function (a) { return id.of(f(a)); })(s).extract(); };
return function (s) { return _this.modifyF(Identity_1.identity)(function (a) { return Identity_1.identity.of(f(a)); })(s).extract(); };
};

@@ -409,3 +408,3 @@ Traversal.prototype.set = function (a) {

return new Fold(function (M) { return function (f) { return function (s) {
return _this.modifyF(const_.getApplicative(M))(function (a) { return new const_.Const(f(a)); })(s).fold(function_1.identity);
return _this.modifyF(Const_1.getApplicative(M))(function (a) { return new Const_1.Const(f(a)); })(s).fold(function_1.identity);
}; }; });

@@ -502,6 +501,6 @@ };

this._tag = 'Fold';
this.getAll = foldMap(Monoid_1.monoidArray)(function (a) { return [a]; });
this.getAll = foldMap(Monoid_1.getArrayMonoid())(function (a) { return [a]; });
this.exist = foldMap(Monoid_1.monoidAny);
this.all = foldMap(Monoid_1.monoidAll);
this.foldMapFirst = foldMap(option.getFirstMonoid());
this.foldMapFirst = foldMap(Option_1.getFirstMonoid());
}

@@ -539,3 +538,3 @@ /** compose a Fold with a Fold */

Fold.prototype.find = function (p) {
return this.foldMapFirst(function (a) { return (p(a) ? option.of(a) : option.none); });
return this.foldMapFirst(function (a) { return (p(a) ? Option_1.option.of(a) : Option_1.none); });
};

@@ -588,3 +587,5 @@ /** get the first target of a Fold */

return function () {
return new Traversal(function (F) { return function (f) { return function (s) { return T.traverse(F)(f, s); }; }; });
return new Traversal(function (F) { return function (f) { return function (s) {
return T.traverse(F)(s, f);
}; }; });
};

@@ -594,5 +595,5 @@ }

function fromFoldable(F) {
return function () { return new Fold(function (M) { return function (f) { return function (s) { return Foldable_1.foldMap(F, M)(f)(s); }; }; }); };
return function () { return new Fold(function (M) { return function (f) { return function (s) { return Foldable_1.foldMap(F, M)(s, f); }; }; }); };
}
exports.fromFoldable = fromFoldable;
//# sourceMappingURL=index.js.map
{
"name": "monocle-ts",
"version": "0.5.2",
"version": "0.5.3-rc",
"description": "A porting of scala monocle library to TypeScript",

@@ -12,3 +12,3 @@ "files": ["lib"],

"typings-checker --allow-expect-error --project typings-checker/tsconfig.json typings-checker/index.ts",
"mocha": "mocha -r ts-node/register test/*.ts",
"mocha": "TS_NODE_CACHE=false mocha -r ts-node/register test/*.ts",
"prettier":

@@ -38,3 +38,3 @@ "prettier --no-semi --single-quote --print-width 120 --parser typescript --list-different \"{src,test,examples}/**/*.ts\"",

"dependencies": {
"fp-ts": "^0.6.4"
"fp-ts": "^1.0.0-rc"
},

@@ -50,3 +50,3 @@ "devDependencies": {

"tslint-config-standard": "4.0.0",
"typescript": "2.6.1",
"typescript": "^2.7.1",
"typings-checker": "1.1.2"

@@ -53,0 +53,0 @@ },

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc