Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

purify-ts

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

purify-ts - npm Package Compare versions

Comparing version 0.14.0 to 0.14.1

es/index.d.ts

6

Either.d.ts

@@ -32,2 +32,4 @@ import { Maybe } from './Maybe';

chain<R2>(f: (value: R) => Either<L, R2>): Either<L, R2>;
/** The same as Either#chain but executes the transformation function only if the value is Left. Useful for recovering from errors */
chainLeft<L2>(f: (value: L) => Either<L2, R>): Either<L2, R>;
/** Flattens nested Eithers. `e.join()` is equivalent to `e.chain(x => x)` */

@@ -37,3 +39,4 @@ join<R2>(this: Either<L, Either<L, R2>>): Either<L, R2>;

alt(other: Either<L, R>): Either<L, R>;
/** Takes a reducer and a initial value and returns the initial value if `this` is `Left` or the result of applying the function to the initial value and the value inside `this` */
/** Takes a reducer and an initial value and returns the initial value if `this` is `Left` or the result of applying the function to the initial value and the value inside `this` */
reduce<T>(reducer: (accumulator: T, value: R) => T, initialValue: T): T;
/** Returns `this` if it\'s a `Left`, otherwise it returns the result of applying the function argument to `this` and wrapping it in a `Right` */

@@ -73,3 +76,2 @@ extend<R2>(f: (value: Either<L, R>) => R2): Either<L, R2>;

'fantasy-land/alt'(other: Either<L, R>): Either<L, R>;
reduce<T>(reducer: (accumulator: T, value: R) => T, initialValue: T): T;
'fantasy-land/reduce'<T>(reducer: (accumulator: T, value: R) => T, initialValue: T): T;

@@ -76,0 +78,0 @@ 'fantasy-land/extend'<R2>(f: (value: Either<L, R>) => R2): Either<L, R2>;

@@ -108,2 +108,5 @@ "use strict";

};
Right.prototype.chainLeft = function (_) {
return this;
};
Right.prototype.join = function () {

@@ -221,2 +224,5 @@ return this.__value;

};
Left.prototype.chainLeft = function (f) {
return f(this.__value);
};
Left.prototype.join = function () {

@@ -223,0 +229,0 @@ return this;

@@ -18,7 +18,7 @@ import { Either } from './Either';

run(): Promise<Either<L, R>>;
/** Transforms the the `Right` value of `this` with a given function. If the EitherAsync that is being mapped resolves to a Left then the mapping function won't be called and `run` will resolve the whole thing to that Left, just like the regular Either#map */
/** Transforms the `Right` value of `this` with a given function. If the EitherAsync that is being mapped resolves to a Left then the mapping function won't be called and `run` will resolve the whole thing to that Left, just like the regular Either#map */
map<R2>(f: (value: R) => R2): EitherAsync<L, R2>;
/** Transforms `this` with a function that returns a `EitherAsync`. Behaviour is the same as the regular Either#chain */
chain<R2>(f: (value: R) => EitherAsync<L, R2>): EitherAsync<L, R2>;
/** Convert `this` to a MaybeAsync, discarding any error values */
/** Converts `this` to a MaybeAsync, discarding any error values */
toMaybeAsync(): MaybeAsync<R>;

@@ -25,0 +25,0 @@ 'fantasy-land/map'<R2>(f: (value: R) => R2): EitherAsync<L, R2>;

@@ -32,2 +32,4 @@ import { Maybe } from './Maybe';

chain<R2>(f: (value: R) => Either<L, R2>): Either<L, R2>;
/** The same as Either#chain but executes the transformation function only if the value is Left. Useful for recovering from errors */
chainLeft<L2>(f: (value: L) => Either<L2, R>): Either<L2, R>;
/** Flattens nested Eithers. `e.join()` is equivalent to `e.chain(x => x)` */

@@ -37,3 +39,4 @@ join<R2>(this: Either<L, Either<L, R2>>): Either<L, R2>;

alt(other: Either<L, R>): Either<L, R>;
/** Takes a reducer and a initial value and returns the initial value if `this` is `Left` or the result of applying the function to the initial value and the value inside `this` */
/** Takes a reducer and an initial value and returns the initial value if `this` is `Left` or the result of applying the function to the initial value and the value inside `this` */
reduce<T>(reducer: (accumulator: T, value: R) => T, initialValue: T): T;
/** Returns `this` if it\'s a `Left`, otherwise it returns the result of applying the function argument to `this` and wrapping it in a `Right` */

@@ -73,3 +76,2 @@ extend<R2>(f: (value: Either<L, R>) => R2): Either<L, R2>;

'fantasy-land/alt'(other: Either<L, R>): Either<L, R>;
reduce<T>(reducer: (accumulator: T, value: R) => T, initialValue: T): T;
'fantasy-land/reduce'<T>(reducer: (accumulator: T, value: R) => T, initialValue: T): T;

@@ -76,0 +78,0 @@ 'fantasy-land/extend'<R2>(f: (value: Either<L, R>) => R2): Either<L, R2>;

@@ -75,2 +75,5 @@ "use strict";

}
chainLeft(_) {
return this;
}
join() {

@@ -187,2 +190,5 @@ return this.__value;

}
chainLeft(f) {
return f(this.__value);
}
join() {

@@ -189,0 +195,0 @@ return this;

@@ -18,7 +18,7 @@ import { Either } from './Either';

run(): Promise<Either<L, R>>;
/** Transforms the the `Right` value of `this` with a given function. If the EitherAsync that is being mapped resolves to a Left then the mapping function won't be called and `run` will resolve the whole thing to that Left, just like the regular Either#map */
/** Transforms the `Right` value of `this` with a given function. If the EitherAsync that is being mapped resolves to a Left then the mapping function won't be called and `run` will resolve the whole thing to that Left, just like the regular Either#map */
map<R2>(f: (value: R) => R2): EitherAsync<L, R2>;
/** Transforms `this` with a function that returns a `EitherAsync`. Behaviour is the same as the regular Either#chain */
chain<R2>(f: (value: R) => EitherAsync<L, R2>): EitherAsync<L, R2>;
/** Convert `this` to a MaybeAsync, discarding any error values */
/** Converts `this` to a MaybeAsync, discarding any error values */
toMaybeAsync(): MaybeAsync<R>;

@@ -25,0 +25,0 @@ 'fantasy-land/map'<R2>(f: (value: R) => R2): EitherAsync<L, R2>;

@@ -36,3 +36,3 @@ import { Either } from './Either';

join<U>(this: Maybe<Maybe<U>>): Maybe<U>;
/** Takes a reducer and a initial value and returns the initial value if `this` is `Nothing` or the result of applying the function to the initial value and the value inside `this` */
/** Takes a reducer and an initial value and returns the initial value if `this` is `Nothing` or the result of applying the function to the initial value and the value inside `this` */
reduce<U>(reducer: (accumulator: U, value: T) => U, initialValue: U): U;

@@ -72,2 +72,3 @@ /** Returns `this` if it\'s `Nothing`, otherwise it returns the result of applying the function argument to `this` and wrapping it in a `Just` */

'fantasy-land/extend'<U>(f: (value: Maybe<T>) => U): Maybe<U>;
'fantasy-land/filter'(pred: (value: T) => boolean): Maybe<T>;
}

@@ -135,7 +136,8 @@ interface MaybeTypeRef {

'fantasy-land/extend'<U>(f: (value: Maybe<never>) => U): Maybe<U>;
'fantasy-land/filter'(pred: (value: never) => boolean): Maybe<never>;
}
/** Constructs a Just. Respents an optional value that exists. */
/** Constructs a Just. Represents an optional value that exists */
declare const just: <T>(value: T) => Maybe<T>;
/** Represents a missing value, you can think of it as a smart 'null'. */
/** Represents a missing value, you can think of it as a smart 'null' */
declare const nothing: Nothing;
export { just as Just, nothing as Nothing };

@@ -160,2 +160,5 @@ "use strict";

}
'fantasy-land/filter'(pred) {
return this.filter(pred);
}
}

@@ -263,9 +266,12 @@ Just.prototype.constructor = exports.Maybe;

}
'fantasy-land/filter'(pred) {
return this.filter(pred);
}
}
Nothing.prototype.constructor = exports.Maybe;
/** Constructs a Just. Respents an optional value that exists. */
/** Constructs a Just. Represents an optional value that exists */
const just = (value) => new Just(value);
exports.Just = just;
/** Represents a missing value, you can think of it as a smart 'null'. */
/** Represents a missing value, you can think of it as a smart 'null' */
const nothing = new Nothing();
exports.Nothing = nothing;

@@ -30,3 +30,3 @@ export interface TupleTypeRef {

map<S2>(f: (snd: S) => S2): Tuple<F, S2>;
/** A somewhat arbitraty implementation of Foldable for Tuple, the reducer will be passed the initial value and the second value insinde `this` as arguments */
/** A somewhat arbitrary implementation of Foldable for Tuple, the reducer will be passed the initial value and the second value inside `this` as arguments */
reduce<T>(reducer: (accumulator: T, value: S) => T, initialValue: T): T;

@@ -33,0 +33,0 @@ /** Returns an array with 2 elements - the values inside `this` */

@@ -36,3 +36,3 @@ import { Either } from './Either';

join<U>(this: Maybe<Maybe<U>>): Maybe<U>;
/** Takes a reducer and a initial value and returns the initial value if `this` is `Nothing` or the result of applying the function to the initial value and the value inside `this` */
/** Takes a reducer and an initial value and returns the initial value if `this` is `Nothing` or the result of applying the function to the initial value and the value inside `this` */
reduce<U>(reducer: (accumulator: U, value: T) => U, initialValue: U): U;

@@ -72,2 +72,3 @@ /** Returns `this` if it\'s `Nothing`, otherwise it returns the result of applying the function argument to `this` and wrapping it in a `Just` */

'fantasy-land/extend'<U>(f: (value: Maybe<T>) => U): Maybe<U>;
'fantasy-land/filter'(pred: (value: T) => boolean): Maybe<T>;
}

@@ -135,7 +136,8 @@ interface MaybeTypeRef {

'fantasy-land/extend'<U>(f: (value: Maybe<never>) => U): Maybe<U>;
'fantasy-land/filter'(pred: (value: never) => boolean): Maybe<never>;
}
/** Constructs a Just. Respents an optional value that exists. */
/** Constructs a Just. Represents an optional value that exists */
declare const just: <T>(value: T) => Maybe<T>;
/** Represents a missing value, you can think of it as a smart 'null'. */
/** Represents a missing value, you can think of it as a smart 'null' */
declare const nothing: Nothing;
export { just as Just, nothing as Nothing };

@@ -160,2 +160,5 @@ "use strict";

};
Just.prototype['fantasy-land/filter'] = function (pred) {
return this.filter(pred);
};
return Just;

@@ -266,10 +269,13 @@ }());

};
Nothing.prototype['fantasy-land/filter'] = function (pred) {
return this.filter(pred);
};
return Nothing;
}());
Nothing.prototype.constructor = exports.Maybe;
/** Constructs a Just. Respents an optional value that exists. */
/** Constructs a Just. Represents an optional value that exists */
var just = function (value) { return new Just(value); };
exports.Just = just;
/** Represents a missing value, you can think of it as a smart 'null'. */
/** Represents a missing value, you can think of it as a smart 'null' */
var nothing = new Nothing();
exports.Nothing = nothing;
{
"name": "purify-ts",
"version": "0.14.0",
"version": "0.14.1",
"description": "Functional programming standard library for TypeScript ",

@@ -34,5 +34,5 @@ "main": "lib/index.js",

"ts-jest": "^24.0.0",
"typescript": "3.7.3"
"typescript": "3.7.5"
},
"dependencies": {}
}

@@ -30,3 +30,3 @@ export interface TupleTypeRef {

map<S2>(f: (snd: S) => S2): Tuple<F, S2>;
/** A somewhat arbitraty implementation of Foldable for Tuple, the reducer will be passed the initial value and the second value insinde `this` as arguments */
/** A somewhat arbitrary implementation of Foldable for Tuple, the reducer will be passed the initial value and the second value inside `this` as arguments */
reduce<T>(reducer: (accumulator: T, value: S) => T, initialValue: T): T;

@@ -33,0 +33,0 @@ /** Returns an array with 2 elements - the values inside `this` */

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc