New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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 1.3.1 to 1.3.2

14

Codec.js

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

var NonEmptyList_1 = require("./NonEmptyList");
var serializeValue = function (_, value) {
return typeof value === 'bigint' ? value.toString() : value;
};
var isEmptySchema = function (schema) {

@@ -73,4 +76,4 @@ return Object.keys(schema).length === 0;

: Array.isArray(input)
? 'an array with value ' + JSON.stringify(input)
: 'an object with value ' + JSON.stringify(input);
? 'an array with value ' + JSON.stringify(input, serializeValue)
: 'an object with value ' + JSON.stringify(input, serializeValue);
break;

@@ -90,3 +93,4 @@ case 'boolean':

receivedString =
receivedString || "a ".concat(typeof input, " with value ").concat(JSON.stringify(input));
receivedString ||
"a ".concat(typeof input, " with value ").concat(JSON.stringify(input, serializeValue));
return "Expected ".concat(expectedType, ", but received ").concat(receivedString);

@@ -139,5 +143,3 @@ };

!properties[key]._isOptional) {
return (0, Either_1.Left)("Problem with property \"".concat(key, "\": it does not exist in received object ").concat(JSON.stringify(input, function (_, value) {
return typeof value === 'bigint' ? value.toString() : value;
})));
return (0, Either_1.Left)("Problem with property \"".concat(key, "\": it does not exist in received object ").concat(JSON.stringify(input, serializeValue)));
}

@@ -144,0 +146,0 @@ var decodedProperty = properties[key].decode(input[key]);

@@ -119,3 +119,3 @@ "use strict";

Right.prototype.inspect = function () {
return "Right(".concat(JSON.stringify(this.__value), ")");
return "Right(".concat(this.__value, ")");
};

@@ -122,0 +122,0 @@ Right.prototype.toString = function () {

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

/** 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>;
map<R2>(f: (value: R) => R2): EitherAsync<L, Awaited<R2>>;
/** Maps the `Left` value of `this`, acts like an identity if `this` is `Right` */

@@ -45,4 +45,4 @@ mapLeft<L2>(f: (value: L) => L2): EitherAsync<L2, R>;

chainLeft<L2, R2>(f: (value: L) => PromiseLike<Either<L2, R2>>): EitherAsync<L2, R | R2>;
/** Flattens nested `EitherAsync`s. `e.join()` is equivalent to `e.chain(x => x)` */
join<L2, R2>(this: EitherAsync<L, EitherAsync<L2, R2>>): EitherAsync<L | L2, R2>;
/** Flattens an `Either` nested inside an `EitherAsync`. `e.join()` is equivalent to `e.chain(async x => x)` */
join<L2, R2>(this: EitherAsync<L, Either<L2, R2>>): EitherAsync<L | L2, R2>;
/** Converts `this` to a MaybeAsync, discarding any error values */

@@ -71,3 +71,3 @@ toMaybeAsync(): MaybeAsync<R>;

finally(effect: () => any): EitherAsync<L, R>;
'fantasy-land/map'<R2>(f: (value: R) => R2): EitherAsync<L, R2>;
'fantasy-land/map'<R2>(f: (value: R) => R2): EitherAsync<L, Awaited<R2>>;
'fantasy-land/bimap'<L2, R2>(f: (value: L) => L2, g: (value: R) => R2): EitherAsync<L2, R2>;

@@ -74,0 +74,0 @@ 'fantasy-land/chain'<R2>(f: (value: R) => PromiseLike<Either<L, R2>>): EitherAsync<L, R2>;

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

const NonEmptyList_1 = require("./NonEmptyList");
const serializeValue = (_, value) => {
return typeof value === 'bigint' ? value.toString() : value;
};
const isEmptySchema = (schema) => Object.keys(schema).length === 0;

@@ -22,4 +25,4 @@ const isObject = (obj) => typeof obj === 'object' && obj !== null && !Array.isArray(obj);

: Array.isArray(input)
? 'an array with value ' + JSON.stringify(input)
: 'an object with value ' + JSON.stringify(input);
? 'an array with value ' + JSON.stringify(input, serializeValue)
: 'an object with value ' + JSON.stringify(input, serializeValue);
break;

@@ -39,3 +42,4 @@ case 'boolean':

receivedString =
receivedString || `a ${typeof input} with value ${JSON.stringify(input)}`;
receivedString ||
`a ${typeof input} with value ${JSON.stringify(input, serializeValue)}`;
return `Expected ${expectedType}, but received ${receivedString}`;

@@ -84,5 +88,3 @@ };

!properties[key]._isOptional) {
return (0, Either_1.Left)(`Problem with property "${key}": it does not exist in received object ${JSON.stringify(input, (_, value) => {
return typeof value === 'bigint' ? value.toString() : value;
})}`);
return (0, Either_1.Left)(`Problem with property "${key}": it does not exist in received object ${JSON.stringify(input, serializeValue)}`);
}

@@ -89,0 +91,0 @@ const decodedProperty = properties[key].decode(input[key]);

@@ -75,3 +75,3 @@ "use strict";

inspect() {
return `Right(${JSON.stringify(this.__value)})`;
return `Right(${this.__value})`;
}

@@ -78,0 +78,0 @@ toString() {

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

/** 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>;
map<R2>(f: (value: R) => R2): EitherAsync<L, Awaited<R2>>;
/** Maps the `Left` value of `this`, acts like an identity if `this` is `Right` */

@@ -45,4 +45,4 @@ mapLeft<L2>(f: (value: L) => L2): EitherAsync<L2, R>;

chainLeft<L2, R2>(f: (value: L) => PromiseLike<Either<L2, R2>>): EitherAsync<L2, R | R2>;
/** Flattens nested `EitherAsync`s. `e.join()` is equivalent to `e.chain(x => x)` */
join<L2, R2>(this: EitherAsync<L, EitherAsync<L2, R2>>): EitherAsync<L | L2, R2>;
/** Flattens an `Either` nested inside an `EitherAsync`. `e.join()` is equivalent to `e.chain(async x => x)` */
join<L2, R2>(this: EitherAsync<L, Either<L2, R2>>): EitherAsync<L | L2, R2>;
/** Converts `this` to a MaybeAsync, discarding any error values */

@@ -71,3 +71,3 @@ toMaybeAsync(): MaybeAsync<R>;

finally(effect: () => any): EitherAsync<L, R>;
'fantasy-land/map'<R2>(f: (value: R) => R2): EitherAsync<L, R2>;
'fantasy-land/map'<R2>(f: (value: R) => R2): EitherAsync<L, Awaited<R2>>;
'fantasy-land/bimap'<L2, R2>(f: (value: L) => L2, g: (value: R) => R2): EitherAsync<L2, R2>;

@@ -74,0 +74,0 @@ 'fantasy-land/chain'<R2>(f: (value: R) => PromiseLike<Either<L, R2>>): EitherAsync<L, R2>;

@@ -98,3 +98,3 @@ "use strict";

inspect() {
return `Just(${JSON.stringify(this.__value)})`;
return `Just(${this.__value})`;
}

@@ -101,0 +101,0 @@ toString() {

@@ -29,3 +29,3 @@ import { Maybe, MaybePatterns } from './Maybe';

/** Transforms the value inside `this` with a given function. If the MaybeAsync that is being mapped resolves to Nothing then the mapping function won't be called and `run` will resolve the whole thing to Nothing, just like the regular Maybe#map */
map<U>(f: (value: T) => U): MaybeAsync<U>;
map<U>(f: (value: T) => U): MaybeAsync<Awaited<U>>;
/** Transforms `this` with a function that returns a `MaybeAsync`. Behaviour is the same as the regular Maybe#chain */

@@ -51,4 +51,4 @@ chain<U>(f: (value: T) => PromiseLike<Maybe<U>>): MaybeAsync<U>;

filter(pred: (value: T) => boolean): MaybeAsync<T>;
/** Flattens nested `MaybeAsync`s. `m.join()` is equivalent to `m.chain(x => x)` */
join<U>(this: MaybeAsync<MaybeAsync<U>>): MaybeAsync<U>;
/** Flattens a `Maybe` nested inside a `MaybeAsync`. `m.join()` is equivalent to `m.chain(async x => x)` */
join<U>(this: MaybeAsync<Maybe<U>>): MaybeAsync<U>;
/** Useful if you are not interested in the result of an operation */

@@ -59,3 +59,3 @@ void(): MaybeAsync<void>;

finally(effect: () => any): MaybeAsync<T>;
'fantasy-land/map'<U>(f: (value: T) => U): MaybeAsync<U>;
'fantasy-land/map'<U>(f: (value: T) => U): MaybeAsync<Awaited<U>>;
'fantasy-land/chain'<U>(f: (value: T) => PromiseLike<Maybe<U>>): MaybeAsync<U>;

@@ -62,0 +62,0 @@ 'fantasy-land/ap'<U>(maybeF: MaybeAsync<(value: T) => U>): MaybeAsync<U>;

@@ -5,2 +5,5 @@ import { Either, Right, Left } from "./Either.js";

import { NonEmptyList } from "./NonEmptyList.js";
const serializeValue = (_, value) => {
return typeof value === 'bigint' ? value.toString() : value;
};
const isEmptySchema = (schema) => Object.keys(schema).length === 0;

@@ -19,4 +22,4 @@ const isObject = (obj) => typeof obj === 'object' && obj !== null && !Array.isArray(obj);

: Array.isArray(input)
? 'an array with value ' + JSON.stringify(input)
: 'an object with value ' + JSON.stringify(input);
? 'an array with value ' + JSON.stringify(input, serializeValue)
: 'an object with value ' + JSON.stringify(input, serializeValue);
break;

@@ -36,3 +39,4 @@ case 'boolean':

receivedString =
receivedString || `a ${typeof input} with value ${JSON.stringify(input)}`;
receivedString ||
`a ${typeof input} with value ${JSON.stringify(input, serializeValue)}`;
return `Expected ${expectedType}, but received ${receivedString}`;

@@ -80,5 +84,3 @@ };

!properties[key]._isOptional) {
return Left(`Problem with property "${key}": it does not exist in received object ${JSON.stringify(input, (_, value) => {
return typeof value === 'bigint' ? value.toString() : value;
})}`);
return Left(`Problem with property "${key}": it does not exist in received object ${JSON.stringify(input, serializeValue)}`);
}

@@ -85,0 +87,0 @@ const decodedProperty = properties[key].decode(input[key]);

@@ -72,3 +72,3 @@ import { Just, Nothing } from "./Maybe.js";

inspect() {
return `Right(${JSON.stringify(this.__value)})`;
return `Right(${this.__value})`;
}

@@ -75,0 +75,0 @@ toString() {

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

/** 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>;
map<R2>(f: (value: R) => R2): EitherAsync<L, Awaited<R2>>;
/** Maps the `Left` value of `this`, acts like an identity if `this` is `Right` */

@@ -45,4 +45,4 @@ mapLeft<L2>(f: (value: L) => L2): EitherAsync<L2, R>;

chainLeft<L2, R2>(f: (value: L) => PromiseLike<Either<L2, R2>>): EitherAsync<L2, R | R2>;
/** Flattens nested `EitherAsync`s. `e.join()` is equivalent to `e.chain(x => x)` */
join<L2, R2>(this: EitherAsync<L, EitherAsync<L2, R2>>): EitherAsync<L | L2, R2>;
/** Flattens an `Either` nested inside an `EitherAsync`. `e.join()` is equivalent to `e.chain(async x => x)` */
join<L2, R2>(this: EitherAsync<L, Either<L2, R2>>): EitherAsync<L | L2, R2>;
/** Converts `this` to a MaybeAsync, discarding any error values */

@@ -71,3 +71,3 @@ toMaybeAsync(): MaybeAsync<R>;

finally(effect: () => any): EitherAsync<L, R>;
'fantasy-land/map'<R2>(f: (value: R) => R2): EitherAsync<L, R2>;
'fantasy-land/map'<R2>(f: (value: R) => R2): EitherAsync<L, Awaited<R2>>;
'fantasy-land/bimap'<L2, R2>(f: (value: L) => L2, g: (value: R) => R2): EitherAsync<L2, R2>;

@@ -74,0 +74,0 @@ 'fantasy-land/chain'<R2>(f: (value: R) => PromiseLike<Either<L, R2>>): EitherAsync<L, R2>;

@@ -95,3 +95,3 @@ import { Left, Right } from "./Either.js";

inspect() {
return `Just(${JSON.stringify(this.__value)})`;
return `Just(${this.__value})`;
}

@@ -98,0 +98,0 @@ toString() {

@@ -29,3 +29,3 @@ import { Maybe, MaybePatterns } from './Maybe';

/** Transforms the value inside `this` with a given function. If the MaybeAsync that is being mapped resolves to Nothing then the mapping function won't be called and `run` will resolve the whole thing to Nothing, just like the regular Maybe#map */
map<U>(f: (value: T) => U): MaybeAsync<U>;
map<U>(f: (value: T) => U): MaybeAsync<Awaited<U>>;
/** Transforms `this` with a function that returns a `MaybeAsync`. Behaviour is the same as the regular Maybe#chain */

@@ -51,4 +51,4 @@ chain<U>(f: (value: T) => PromiseLike<Maybe<U>>): MaybeAsync<U>;

filter(pred: (value: T) => boolean): MaybeAsync<T>;
/** Flattens nested `MaybeAsync`s. `m.join()` is equivalent to `m.chain(x => x)` */
join<U>(this: MaybeAsync<MaybeAsync<U>>): MaybeAsync<U>;
/** Flattens a `Maybe` nested inside a `MaybeAsync`. `m.join()` is equivalent to `m.chain(async x => x)` */
join<U>(this: MaybeAsync<Maybe<U>>): MaybeAsync<U>;
/** Useful if you are not interested in the result of an operation */

@@ -59,3 +59,3 @@ void(): MaybeAsync<void>;

finally(effect: () => any): MaybeAsync<T>;
'fantasy-land/map'<U>(f: (value: T) => U): MaybeAsync<U>;
'fantasy-land/map'<U>(f: (value: T) => U): MaybeAsync<Awaited<U>>;
'fantasy-land/chain'<U>(f: (value: T) => PromiseLike<Maybe<U>>): MaybeAsync<U>;

@@ -62,0 +62,0 @@ 'fantasy-land/ap'<U>(maybeF: MaybeAsync<(value: T) => U>): MaybeAsync<U>;

@@ -131,3 +131,3 @@ "use strict";

Just.prototype.inspect = function () {
return "Just(".concat(JSON.stringify(this.__value), ")");
return "Just(".concat(this.__value, ")");
};

@@ -134,0 +134,0 @@ Just.prototype.toString = function () {

@@ -29,3 +29,3 @@ import { Maybe, MaybePatterns } from './Maybe';

/** Transforms the value inside `this` with a given function. If the MaybeAsync that is being mapped resolves to Nothing then the mapping function won't be called and `run` will resolve the whole thing to Nothing, just like the regular Maybe#map */
map<U>(f: (value: T) => U): MaybeAsync<U>;
map<U>(f: (value: T) => U): MaybeAsync<Awaited<U>>;
/** Transforms `this` with a function that returns a `MaybeAsync`. Behaviour is the same as the regular Maybe#chain */

@@ -51,4 +51,4 @@ chain<U>(f: (value: T) => PromiseLike<Maybe<U>>): MaybeAsync<U>;

filter(pred: (value: T) => boolean): MaybeAsync<T>;
/** Flattens nested `MaybeAsync`s. `m.join()` is equivalent to `m.chain(x => x)` */
join<U>(this: MaybeAsync<MaybeAsync<U>>): MaybeAsync<U>;
/** Flattens a `Maybe` nested inside a `MaybeAsync`. `m.join()` is equivalent to `m.chain(async x => x)` */
join<U>(this: MaybeAsync<Maybe<U>>): MaybeAsync<U>;
/** Useful if you are not interested in the result of an operation */

@@ -59,3 +59,3 @@ void(): MaybeAsync<void>;

finally(effect: () => any): MaybeAsync<T>;
'fantasy-land/map'<U>(f: (value: T) => U): MaybeAsync<U>;
'fantasy-land/map'<U>(f: (value: T) => U): MaybeAsync<Awaited<U>>;
'fantasy-land/chain'<U>(f: (value: T) => PromiseLike<Maybe<U>>): MaybeAsync<U>;

@@ -62,0 +62,0 @@ 'fantasy-land/ap'<U>(maybeF: MaybeAsync<(value: T) => U>): MaybeAsync<U>;

{
"name": "purify-ts",
"version": "1.3.1",
"version": "1.3.2",
"description": "Functional programming standard library for TypeScript ",

@@ -5,0 +5,0 @@ "repository": "https://github.com/gigobyte/purify.git",

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