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 1.0.0 to 1.1.0

102

Codec.js

@@ -29,6 +29,10 @@ "use strict";

};
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};

@@ -106,3 +110,3 @@ var __values = (this && this.__values) || function(o) {

schema.oneOf.splice(i, 1);
(_a = schema.oneOf).push.apply(_a, __spreadArray([], __read(e.oneOf)));
(_a = schema.oneOf).push.apply(_a, __spreadArray([], __read(e.oneOf), false));
return optimizeSchema(schema);

@@ -126,3 +130,3 @@ }

if (!isObject(input)) {
return Either_1.Left(reportError('an object', input));
return (0, Either_1.Left)(reportError('an object', input));
}

@@ -135,7 +139,7 @@ var result = {};

!properties[key]._isOptional) {
return Either_1.Left("Problem with property \"" + key + "\": it does not exist in received object " + JSON.stringify(input));
return (0, Either_1.Left)("Problem with property \"" + key + "\": it does not exist in received object " + JSON.stringify(input));
}
var decodedProperty = properties[key].decode(input[key]);
if (decodedProperty.isLeft()) {
return Either_1.Left("Problem with the value of property \"" + key + "\": " + decodedProperty.extract());
return (0, Either_1.Left)("Problem with the value of property \"" + key + "\": " + decodedProperty.extract());
}

@@ -155,3 +159,3 @@ var value = decodedProperty.extract();

}
return Either_1.Right(result);
return (0, Either_1.Right)(result);
};

@@ -211,4 +215,4 @@ var encode = function (input) {

return typeof input === 'string'
? Either_1.Right(input)
: Either_1.Left(reportError('a string', input));
? (0, Either_1.Right)(input)
: (0, Either_1.Left)(reportError('a string', input));
},

@@ -222,4 +226,4 @@ encode: Function_1.identity,

return typeof input === 'number'
? Either_1.Right(input)
: Either_1.Left(reportError('a number', input));
? (0, Either_1.Right)(input)
: (0, Either_1.Left)(reportError('a number', input));
},

@@ -232,3 +236,3 @@ encode: Function_1.identity,

decode: function (input) {
return input === null ? Either_1.Right(input) : Either_1.Left(reportError('a null', input));
return input === null ? (0, Either_1.Right)(input) : (0, Either_1.Left)(reportError('a null', input));
},

@@ -241,4 +245,4 @@ encode: Function_1.identity,

return input === undefined
? Either_1.Right(input)
: Either_1.Left(reportError('an undefined', input));
? (0, Either_1.Right)(input)
: (0, Either_1.Left)(reportError('an undefined', input));
},

@@ -248,3 +252,3 @@ encode: Function_1.identity

var optional = function (codec) {
return (__assign(__assign({}, exports.oneOf([codec, undefinedType])), { schema: codec.schema, _isOptional: true }));
return (__assign(__assign({}, (0, exports.oneOf)([codec, undefinedType])), { schema: codec.schema, _isOptional: true }));
};

@@ -254,3 +258,3 @@ exports.optional = optional;

var nullable = function (codec) {
return exports.oneOf([codec, exports.nullType]);
return (0, exports.oneOf)([codec, exports.nullType]);
};

@@ -262,4 +266,4 @@ exports.nullable = nullable;

return typeof input === 'boolean'
? Either_1.Right(input)
: Either_1.Left(reportError('a boolean', input));
? (0, Either_1.Right)(input)
: (0, Either_1.Left)(reportError('a boolean', input));
},

@@ -280,3 +284,3 @@ encode: Function_1.identity,

decode: function (input) {
return exports.oneOf([exports.string, exports.number])
return (0, exports.oneOf)([exports.string, exports.number])
.decode(input)

@@ -286,4 +290,4 @@ .chain(function (x) {

return enumIndex !== -1
? Either_1.Right(enumValues[enumIndex])
: Either_1.Left(reportError('an enum member', input));
? (0, Either_1.Right)(enumValues[enumIndex])
: (0, Either_1.Left)(reportError('an enum member', input));
});

@@ -321,3 +325,3 @@ },

}
return Either_1.Left("One of the following problems occured: " + errors
return (0, Either_1.Left)("One of the following problems occured: " + errors
.map(function (err, i) { return "(" + i + ") " + err; })

@@ -362,3 +366,3 @@ .join(', '));

if (!Array.isArray(input)) {
return Either_1.Left(reportError('an array', input));
return (0, Either_1.Left)(reportError('an array', input));
}

@@ -373,6 +377,6 @@ else {

else {
return Either_1.Left("Problem with the value at index " + i + ": " + decoded.extract());
return (0, Either_1.Left)("Problem with the value at index " + i + ": " + decoded.extract());
}
}
return Either_1.Right(result);
return (0, Either_1.Right)(result);
}

@@ -393,3 +397,3 @@ },

.chain(function (x) {
return isFinite(+x) ? Either_1.Right(x) : Either_1.Left(reportError('a number', input));
return isFinite(+x) ? (0, Either_1.Right)(x) : (0, Either_1.Left)(reportError('a number', input));
});

@@ -408,3 +412,3 @@ },

if (!isObject(input)) {
return Either_1.Left(reportError('an object', input));
return (0, Either_1.Left)(reportError('an object', input));
}

@@ -421,6 +425,6 @@ try {

else if (decodedKey.isLeft()) {
return Either_1.Left("Problem with key type of property \"" + key + "\": " + decodedKey.extract());
return (0, Either_1.Left)("Problem with key type of property \"" + key + "\": " + decodedKey.extract());
}
else if (decodedValue.isLeft()) {
return Either_1.Left("Problem with the value of property \"" + key + "\": " + decodedValue.extract());
return (0, Either_1.Left)("Problem with the value of property \"" + key + "\": " + decodedValue.extract());
}

@@ -437,3 +441,3 @@ }

}
return Either_1.Right(result);
return (0, Either_1.Right)(result);
},

@@ -465,4 +469,4 @@ encode: function (input) {

return expectedValues.includes(input)
? Either_1.Right(input)
: Either_1.Left(reportError(expectedValues.map(function (x) { return JSON.stringify(x); }).join(', '), input));
? (0, Either_1.Right)(input)
: (0, Either_1.Left)(reportError(expectedValues.map(function (x) { return JSON.stringify(x); }).join(', '), input));
},

@@ -496,3 +500,3 @@ encode: Function_1.identity,

Just: function (x) { return codec.decode(x).map(Maybe_1.Just); },
Nothing: function () { return Either_1.Right(Maybe_1.Nothing); }
Nothing: function () { return (0, Either_1.Right)(Maybe_1.Nothing); }
});

@@ -512,3 +516,3 @@ },

var nonEmptyList = function (codec) {
var arrayCodec = exports.array(codec);
var arrayCodec = (0, exports.array)(codec);
return exports.Codec.custom({

@@ -532,6 +536,6 @@ decode: function (input) {

if (!Array.isArray(input)) {
return Either_1.Left(reportError('an array', input));
return (0, Either_1.Left)(reportError('an array', input));
}
else if (codecs.length !== input.length) {
return Either_1.Left("Expected an array of length " + codecs.length + ", but received an array with length of " + input.length);
return (0, Either_1.Left)("Expected an array of length " + codecs.length + ", but received an array with length of " + input.length);
}

@@ -546,6 +550,6 @@ else {

else {
return Either_1.Left("Problem with the value at index " + i + ": " + decoded.extract());
return (0, Either_1.Left)("Problem with the value at index " + i + ": " + decoded.extract());
}
}
return Either_1.Right(result);
return (0, Either_1.Right)(result);
}

@@ -572,4 +576,4 @@ },

return Number.isNaN(Date.parse(x))
? Either_1.Left('Expected a valid date string, but received a string that cannot be parsed')
: Either_1.Right(new Date(x));
? (0, Either_1.Left)('Expected a valid date string, but received a string that cannot be parsed')
: (0, Either_1.Right)(new Date(x));
});

@@ -595,4 +599,4 @@ },

return isObject(valuet) && isObject(valueu)
? Either_1.Right(Object.assign(valuet, valueu))
: Either_1.Right(valueu);
? (0, Either_1.Right)(Object.assign(valuet, valueu))
: (0, Either_1.Right)(valueu);
},

@@ -614,3 +618,3 @@ encode: function (input) {

decode: function (input) {
return exports.array(exports.tuple([keyCodec, valueCodec]))
return (0, exports.array)((0, exports.tuple)([keyCodec, valueCodec]))
.decode(input)

@@ -691,3 +695,3 @@ .map(function (pairs) { return new Map(pairs); });

.split(oneOfSeparatorRegex)
.map(function (x) { return exports.parseError(x.replace(x.match(oneOfCounterRegex)[0], '')); })
.map(function (x) { return (0, exports.parseError)(x.replace(x.match(oneOfCounterRegex)[0], '')); })
};

@@ -737,3 +741,3 @@ }

property: property,
error: exports.parseError(restOfError.join(''))
error: (0, exports.parseError)(restOfError.join(''))
};

@@ -743,3 +747,3 @@ }

if (error.startsWith(dateFailureMarket)) {
return exports.parseError(error.replace(dateFailureMarket, ''));
return (0, exports.parseError)(error.replace(dateFailureMarket, ''));
}

@@ -754,3 +758,3 @@ // Problem with the value at index 0: *

index: Number(index),
error: exports.parseError(restOfError.join(''))
error: (0, exports.parseError)(restOfError.join(''))
};

@@ -757,0 +761,0 @@ }

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

Right.prototype.toMaybe = function () {
return Maybe_1.Just(this.__value);
return (0, Maybe_1.Just)(this.__value);
};

@@ -295,3 +295,3 @@ Right.prototype.leftToMaybe = function () {

Left.prototype.leftToMaybe = function () {
return Maybe_1.Just(this.__value);
return (0, Maybe_1.Just)(this.__value);
};

@@ -298,0 +298,0 @@ Left.prototype.extract = function () {

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

var _this = this;
return exports.EitherAsync(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
return (0, exports.EitherAsync)(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
var either, nestedEither;

@@ -107,3 +107,3 @@ return __generator(this, function (_b) {

var _this = this;
return exports.EitherAsync(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
return (0, exports.EitherAsync)(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
var otherValue, thisValue;

@@ -133,3 +133,3 @@ return __generator(this, function (_b) {

var _this = this;
return exports.EitherAsync(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
return (0, exports.EitherAsync)(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
var thisValue, otherValue;

@@ -153,3 +153,3 @@ return __generator(this, function (_b) {

var _this = this;
return exports.EitherAsync(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
return (0, exports.EitherAsync)(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
var either, v;

@@ -163,3 +163,3 @@ return __generator(this, function (_b) {

v = exports.EitherAsync.liftEither(either);
return [2 /*return*/, helpers.liftEither(Either_1.Right(f(v)))];
return [2 /*return*/, helpers.liftEither((0, Either_1.Right)(f(v)))];
}

@@ -183,3 +183,3 @@ return [2 /*return*/, helpers.liftEither(either)];

e_1 = _c.sent();
return [2 /*return*/, Either_1.Left(e_1)];
return [2 /*return*/, (0, Either_1.Left)(e_1)];
case 3: return [2 /*return*/];

@@ -192,3 +192,3 @@ }

var _this = this;
return exports.EitherAsync(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
return (0, exports.EitherAsync)(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
var either;

@@ -207,7 +207,7 @@ return __generator(this, function (_b) {

var _this = this;
return exports.EitherAsync(function (helpers) { return _this.runPromise(helpers).then(f); });
return (0, exports.EitherAsync)(function (helpers) { return _this.runPromise(helpers).then(f); });
};
EitherAsyncImpl.prototype.mapLeft = function (f) {
var _this = this;
return exports.EitherAsync(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
return (0, exports.EitherAsync)(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
var e_2;

@@ -230,3 +230,3 @@ return __generator(this, function (_b) {

var _this = this;
return exports.EitherAsync(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
return (0, exports.EitherAsync)(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
var value;

@@ -245,3 +245,3 @@ return __generator(this, function (_b) {

var _this = this;
return exports.EitherAsync(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
return (0, exports.EitherAsync)(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
var e_3;

@@ -264,3 +264,3 @@ return __generator(this, function (_b) {

var _this = this;
return MaybeAsync_1.MaybeAsync(function (_b) {
return (0, MaybeAsync_1.MaybeAsync)(function (_b) {
var liftMaybe = _b.liftMaybe;

@@ -282,3 +282,3 @@ return __awaiter(_this, void 0, void 0, function () {

var _this = this;
return exports.EitherAsync(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
return (0, exports.EitherAsync)(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
var either;

@@ -292,3 +292,3 @@ return __generator(this, function (_b) {

helpers.throwE(either.extract());
return [2 /*return*/, helpers.liftEither(Either_1.Right(either.extract()))];
return [2 /*return*/, helpers.liftEither((0, Either_1.Right)(either.extract()))];
}

@@ -300,3 +300,3 @@ });

var _this = this;
return exports.EitherAsync(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
return (0, exports.EitherAsync)(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
var either;

@@ -316,3 +316,3 @@ return __generator(this, function (_b) {

var _this = this;
return exports.EitherAsync(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
return (0, exports.EitherAsync)(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
var either;

@@ -338,3 +338,3 @@ return __generator(this, function (_b) {

var _this = this;
return exports.EitherAsync(function (_b) {
return (0, exports.EitherAsync)(function (_b) {
var fromPromise = _b.fromPromise;

@@ -348,3 +348,3 @@ return fromPromise(_this.run().finally(effect));

exports.EitherAsync = Object.assign(function (runPromise) { return new EitherAsyncImpl(runPromise); }, {
fromPromise: function (f) { return exports.EitherAsync(function (_b) {
fromPromise: function (f) { return (0, exports.EitherAsync)(function (_b) {
var fP = _b.fromPromise;

@@ -354,3 +354,3 @@ return fP(f());

liftEither: function (either) {
return exports.EitherAsync(function (_b) {
return (0, exports.EitherAsync)(function (_b) {
var liftEither = _b.liftEither;

@@ -367,3 +367,3 @@ return liftEither(either);

sequence: function (eas) {
return exports.EitherAsync(function (helpers) { return __awaiter(void 0, void 0, void 0, function () {
return (0, exports.EitherAsync)(function (helpers) { return __awaiter(void 0, void 0, void 0, function () {
var res, eas_1, eas_1_1, e, e_4_1;

@@ -407,3 +407,3 @@ var e_4, _b;

case 11: return [7 /*endfinally*/];
case 12: return [2 /*return*/, helpers.liftEither(Either_1.Right(res))];
case 12: return [2 /*return*/, helpers.liftEither((0, Either_1.Right)(res))];
}

@@ -410,0 +410,0 @@ });

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

if (!isObject(input)) {
return Either_1.Left(reportError('an object', input));
return (0, Either_1.Left)(reportError('an object', input));
}

@@ -82,7 +82,7 @@ const result = {};

!properties[key]._isOptional) {
return Either_1.Left(`Problem with property "${key}": it does not exist in received object ${JSON.stringify(input)}`);
return (0, Either_1.Left)(`Problem with property "${key}": it does not exist in received object ${JSON.stringify(input)}`);
}
const decodedProperty = properties[key].decode(input[key]);
if (decodedProperty.isLeft()) {
return Either_1.Left(`Problem with the value of property "${key}": ${decodedProperty.extract()}`);
return (0, Either_1.Left)(`Problem with the value of property "${key}": ${decodedProperty.extract()}`);
}

@@ -94,3 +94,3 @@ const value = decodedProperty.extract();

}
return Either_1.Right(result);
return (0, Either_1.Right)(result);
};

@@ -135,4 +135,4 @@ const encode = (input) => {

decode: (input) => typeof input === 'string'
? Either_1.Right(input)
: Either_1.Left(reportError('a string', input)),
? (0, Either_1.Right)(input)
: (0, Either_1.Left)(reportError('a string', input)),
encode: Function_1.identity,

@@ -144,4 +144,4 @@ schema: () => ({ type: 'string' })

decode: (input) => typeof input === 'number'
? Either_1.Right(input)
: Either_1.Left(reportError('a number', input)),
? (0, Either_1.Right)(input)
: (0, Either_1.Left)(reportError('a number', input)),
encode: Function_1.identity,

@@ -152,3 +152,3 @@ schema: () => ({ type: 'number' })

exports.nullType = exports.Codec.custom({
decode: (input) => input === null ? Either_1.Right(input) : Either_1.Left(reportError('a null', input)),
decode: (input) => input === null ? (0, Either_1.Right)(input) : (0, Either_1.Left)(reportError('a null', input)),
encode: Function_1.identity,

@@ -159,8 +159,8 @@ schema: () => ({ type: 'null' })

decode: (input) => input === undefined
? Either_1.Right(input)
: Either_1.Left(reportError('an undefined', input)),
? (0, Either_1.Right)(input)
: (0, Either_1.Left)(reportError('an undefined', input)),
encode: Function_1.identity
});
const optional = (codec) => ({
...exports.oneOf([codec, undefinedType]),
...(0, exports.oneOf)([codec, undefinedType]),
schema: codec.schema,

@@ -171,3 +171,3 @@ _isOptional: true

/** A codec for a value T or null. Keep in mind if you use `nullable` inside `Codec.interface` the property will still be required */
const nullable = (codec) => exports.oneOf([codec, exports.nullType]);
const nullable = (codec) => (0, exports.oneOf)([codec, exports.nullType]);
exports.nullable = nullable;

@@ -177,4 +177,4 @@ /** A codec for a boolean value */

decode: (input) => typeof input === 'boolean'
? Either_1.Right(input)
: Either_1.Left(reportError('a boolean', input)),
? (0, Either_1.Right)(input)
: (0, Either_1.Left)(reportError('a boolean', input)),
encode: Function_1.identity,

@@ -194,3 +194,3 @@ schema: () => ({ type: 'boolean' })

decode: (input) => {
return exports.oneOf([exports.string, exports.number])
return (0, exports.oneOf)([exports.string, exports.number])
.decode(input)

@@ -200,4 +200,4 @@ .chain((x) => {

return enumIndex !== -1
? Either_1.Right(enumValues[enumIndex])
: Either_1.Left(reportError('an enum member', input));
? (0, Either_1.Right)(enumValues[enumIndex])
: (0, Either_1.Left)(reportError('an enum member', input));
});

@@ -223,3 +223,3 @@ },

}
return Either_1.Left(`One of the following problems occured: ${errors
return (0, Either_1.Left)(`One of the following problems occured: ${errors
.map((err, i) => `(${i}) ${err}`)

@@ -246,3 +246,3 @@ .join(', ')}`);

if (!Array.isArray(input)) {
return Either_1.Left(reportError('an array', input));
return (0, Either_1.Left)(reportError('an array', input));
}

@@ -257,6 +257,6 @@ else {

else {
return Either_1.Left(`Problem with the value at index ${i}: ${decoded.extract()}`);
return (0, Either_1.Left)(`Problem with the value at index ${i}: ${decoded.extract()}`);
}
}
return Either_1.Right(result);
return (0, Either_1.Right)(result);
}

@@ -274,3 +274,3 @@ },

.decode(input)
.chain((x) => isFinite(+x) ? Either_1.Right(x) : Either_1.Left(reportError('a number', input))),
.chain((x) => isFinite(+x) ? (0, Either_1.Right)(x) : (0, Either_1.Left)(reportError('a number', input))),
encode: Function_1.identity,

@@ -285,3 +285,3 @@ schema: exports.number.schema

if (!isObject(input)) {
return Either_1.Left(reportError('an object', input));
return (0, Either_1.Left)(reportError('an object', input));
}

@@ -296,10 +296,10 @@ for (const key of Object.keys(input)) {

else if (decodedKey.isLeft()) {
return Either_1.Left(`Problem with key type of property "${key}": ${decodedKey.extract()}`);
return (0, Either_1.Left)(`Problem with key type of property "${key}": ${decodedKey.extract()}`);
}
else if (decodedValue.isLeft()) {
return Either_1.Left(`Problem with the value of property "${key}": ${decodedValue.extract()}`);
return (0, Either_1.Left)(`Problem with the value of property "${key}": ${decodedValue.extract()}`);
}
}
}
return Either_1.Right(result);
return (0, Either_1.Right)(result);
},

@@ -324,4 +324,4 @@ encode: (input) => {

decode: (input) => expectedValues.includes(input)
? Either_1.Right(input)
: Either_1.Left(reportError(expectedValues.map((x) => JSON.stringify(x)).join(', '), input)),
? (0, Either_1.Right)(input)
: (0, Either_1.Left)(reportError(expectedValues.map((x) => JSON.stringify(x)).join(', '), input)),
encode: Function_1.identity,

@@ -350,3 +350,3 @@ schema: () => ({

Just: (x) => codec.decode(x).map(Maybe_1.Just),
Nothing: () => Either_1.Right(Maybe_1.Nothing)
Nothing: () => (0, Either_1.Right)(Maybe_1.Nothing)
}),

@@ -366,3 +366,3 @@ encode: (input) => input.map(codec.encode).orDefault(undefined),

const nonEmptyList = (codec) => {
const arrayCodec = exports.array(codec);
const arrayCodec = (0, exports.array)(codec);
return exports.Codec.custom({

@@ -381,6 +381,6 @@ decode: (input) => arrayCodec

if (!Array.isArray(input)) {
return Either_1.Left(reportError('an array', input));
return (0, Either_1.Left)(reportError('an array', input));
}
else if (codecs.length !== input.length) {
return Either_1.Left(`Expected an array of length ${codecs.length}, but received an array with length of ${input.length}`);
return (0, Either_1.Left)(`Expected an array of length ${codecs.length}, but received an array with length of ${input.length}`);
}

@@ -395,6 +395,6 @@ else {

else {
return Either_1.Left(`Problem with the value at index ${i}: ${decoded.extract()}`);
return (0, Either_1.Left)(`Problem with the value at index ${i}: ${decoded.extract()}`);
}
}
return Either_1.Right(result);
return (0, Either_1.Right)(result);
}

@@ -418,4 +418,4 @@ },

.chain((x) => Number.isNaN(Date.parse(x))
? Either_1.Left('Expected a valid date string, but received a string that cannot be parsed')
: Either_1.Right(new Date(x))),
? (0, Either_1.Left)('Expected a valid date string, but received a string that cannot be parsed')
: (0, Either_1.Right)(new Date(x))),
encode: (input) => input.toISOString(),

@@ -438,4 +438,4 @@ schema: () => ({ type: 'string', format: 'date-time' })

return isObject(valuet) && isObject(valueu)
? Either_1.Right(Object.assign(valuet, valueu))
: Either_1.Right(valueu);
? (0, Either_1.Right)(Object.assign(valuet, valueu))
: (0, Either_1.Right)(valueu);
},

@@ -454,3 +454,3 @@ encode: (input) => {

const map = (keyCodec, valueCodec) => exports.Codec.custom({
decode: (input) => exports.array(exports.tuple([keyCodec, valueCodec]))
decode: (input) => (0, exports.array)((0, exports.tuple)([keyCodec, valueCodec]))
.decode(input)

@@ -524,3 +524,3 @@ .map((pairs) => new Map(pairs)),

.split(oneOfSeparatorRegex)
.map((x) => exports.parseError(x.replace(x.match(oneOfCounterRegex)[0], '')))
.map((x) => (0, exports.parseError)(x.replace(x.match(oneOfCounterRegex)[0], '')))
};

@@ -570,3 +570,3 @@ }

property: property,
error: exports.parseError(restOfError.join(''))
error: (0, exports.parseError)(restOfError.join(''))
};

@@ -576,3 +576,3 @@ }

if (error.startsWith(dateFailureMarket)) {
return exports.parseError(error.replace(dateFailureMarket, ''));
return (0, exports.parseError)(error.replace(dateFailureMarket, ''));
}

@@ -587,3 +587,3 @@ // Problem with the value at index 0: *

index: Number(index),
error: exports.parseError(restOfError.join(''))
error: (0, exports.parseError)(restOfError.join(''))
};

@@ -590,0 +590,0 @@ }

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

toMaybe() {
return Maybe_1.Just(this.__value);
return (0, Maybe_1.Just)(this.__value);
}

@@ -250,3 +250,3 @@ leftToMaybe() {

leftToMaybe() {
return Maybe_1.Just(this.__value);
return (0, Maybe_1.Just)(this.__value);
}

@@ -253,0 +253,0 @@ extract() {

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

join() {
return exports.EitherAsync(async (helpers) => {
return (0, exports.EitherAsync)(async (helpers) => {
const either = await this;

@@ -53,3 +53,3 @@ if (either.isRight()) {

ap(eitherF) {
return exports.EitherAsync(async (helpers) => {
return (0, exports.EitherAsync)(async (helpers) => {
const otherValue = await eitherF;

@@ -69,3 +69,3 @@ if (otherValue.isRight()) {

alt(other) {
return exports.EitherAsync(async (helpers) => {
return (0, exports.EitherAsync)(async (helpers) => {
const thisValue = await this;

@@ -82,7 +82,7 @@ if (thisValue.isRight()) {

extend(f) {
return exports.EitherAsync(async (helpers) => {
return (0, exports.EitherAsync)(async (helpers) => {
const either = await this.run();
if (either.isRight()) {
const v = exports.EitherAsync.liftEither(either);
return helpers.liftEither(Either_1.Right(f(v)));
return helpers.liftEither((0, Either_1.Right)(f(v)));
}

@@ -94,10 +94,10 @@ return helpers.liftEither(either);

try {
return Either_1.Right(await this.runPromise(helpers));
return (0, Either_1.Right)(await this.runPromise(helpers));
}
catch (e) {
return Either_1.Left(e);
return (0, Either_1.Left)(e);
}
}
bimap(f, g) {
return exports.EitherAsync(async (helpers) => {
return (0, exports.EitherAsync)(async (helpers) => {
const either = await this.run();

@@ -108,6 +108,6 @@ return helpers.liftEither(either.bimap(f, g));

map(f) {
return exports.EitherAsync((helpers) => this.runPromise(helpers).then(f));
return (0, exports.EitherAsync)((helpers) => this.runPromise(helpers).then(f));
}
mapLeft(f) {
return exports.EitherAsync(async (helpers) => {
return (0, exports.EitherAsync)(async (helpers) => {
try {

@@ -122,3 +122,3 @@ return await this.runPromise(helpers);

chain(f) {
return exports.EitherAsync(async (helpers) => {
return (0, exports.EitherAsync)(async (helpers) => {
const value = await this.runPromise(helpers);

@@ -129,3 +129,3 @@ return helpers.fromPromise(f(value));

chainLeft(f) {
return exports.EitherAsync(async (helpers) => {
return (0, exports.EitherAsync)(async (helpers) => {
try {

@@ -140,3 +140,3 @@ return await this.runPromise(helpers);

toMaybeAsync() {
return MaybeAsync_1.MaybeAsync(async ({ liftMaybe }) => {
return (0, MaybeAsync_1.MaybeAsync)(async ({ liftMaybe }) => {
const either = await this.run();

@@ -147,11 +147,11 @@ return liftMaybe(either.toMaybe());

swap() {
return exports.EitherAsync(async (helpers) => {
return (0, exports.EitherAsync)(async (helpers) => {
const either = await this.run();
if (either.isRight())
helpers.throwE(either.extract());
return helpers.liftEither(Either_1.Right(either.extract()));
return helpers.liftEither((0, Either_1.Right)(either.extract()));
});
}
ifLeft(effect) {
return exports.EitherAsync(async (helpers) => {
return (0, exports.EitherAsync)(async (helpers) => {
const either = await this.run();

@@ -163,3 +163,3 @@ either.ifLeft(effect);

ifRight(effect) {
return exports.EitherAsync(async (helpers) => {
return (0, exports.EitherAsync)(async (helpers) => {
const either = await this.run();

@@ -177,3 +177,3 @@ either.ifRight(effect);

finally(effect) {
return exports.EitherAsync(({ fromPromise }) => fromPromise(this.run().finally(effect)));
return (0, exports.EitherAsync)(({ fromPromise }) => fromPromise(this.run().finally(effect)));
}

@@ -183,7 +183,7 @@ }

exports.EitherAsync = Object.assign((runPromise) => new EitherAsyncImpl(runPromise), {
fromPromise: (f) => exports.EitherAsync(({ fromPromise: fP }) => fP(f())),
liftEither: (either) => exports.EitherAsync(({ liftEither }) => liftEither(either)),
fromPromise: (f) => (0, exports.EitherAsync)(({ fromPromise: fP }) => fP(f())),
liftEither: (either) => (0, exports.EitherAsync)(({ liftEither }) => liftEither(either)),
lefts: (list) => Promise.all(list.map((x) => x.run())).then(Either_1.Either.lefts),
rights: (list) => Promise.all(list.map((x) => x.run())).then(Either_1.Either.rights),
sequence: (eas) => exports.EitherAsync(async (helpers) => {
sequence: (eas) => (0, exports.EitherAsync)(async (helpers) => {
let res = [];

@@ -196,3 +196,3 @@ for await (const e of eas) {

}
return helpers.liftEither(Either_1.Right(res));
return helpers.liftEither((0, Either_1.Right)(res));
}),

@@ -199,0 +199,0 @@ all: (eas) => exports.EitherAsync.fromPromise(async () => Promise.all(eas).then(Either_1.Either.sequence))

@@ -8,11 +8,11 @@ "use strict";

/** Returns Just the first element of an array or Nothing if there is none. If you don't want to work with a Maybe but still keep type safety, check out `NonEmptyList` */
const head = (list) => list.length > 0 ? Maybe_1.Just(list[0]) : Maybe_1.Nothing;
const head = (list) => list.length > 0 ? (0, Maybe_1.Just)(list[0]) : Maybe_1.Nothing;
/** Returns Just the last element of an array or Nothing if there is none */
const last = (list) => list.length > 0 ? Maybe_1.Just(list[list.length - 1]) : Maybe_1.Nothing;
const last = (list) => list.length > 0 ? (0, Maybe_1.Just)(list[list.length - 1]) : Maybe_1.Nothing;
/** Returns all elements of an array except the first */
const tail = (list) => list.length > 0 ? Maybe_1.Just(list.slice(1)) : Maybe_1.Nothing;
const tail = (list) => list.length > 0 ? (0, Maybe_1.Just)(list.slice(1)) : Maybe_1.Nothing;
/** Returns all elements of an array except the last */
const init = (list) => list.length > 0 ? Maybe_1.Just(list.slice(0, -1)) : Maybe_1.Nothing;
const init = (list) => list.length > 0 ? (0, Maybe_1.Just)(list.slice(0, -1)) : Maybe_1.Nothing;
/** Returns a tuple of an array's head and tail */
const uncons = (list) => list.length > 0 ? Maybe_1.Just(Tuple_1.Tuple(list[0], list.slice(1))) : Maybe_1.Nothing;
const uncons = (list) => list.length > 0 ? (0, Maybe_1.Just)((0, Tuple_1.Tuple)(list[0], list.slice(1))) : Maybe_1.Nothing;
/* Returns the sum of all numbers inside an array */

@@ -41,3 +41,3 @@ const sum = (list) => list.reduce((acc, x) => acc + x, 0);

default:
return list[index] === undefined ? Maybe_1.Nothing : Maybe_1.Just(list[index]);
return list[index] === undefined ? Maybe_1.Nothing : (0, Maybe_1.Just)(list[index]);
}

@@ -50,3 +50,3 @@ }

default:
return [...list].sort((x, y) => Function_1.orderToNumber(compare(x, y)));
return [...list].sort((x, y) => (0, Function_1.orderToNumber)(compare(x, y)));
}

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

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

toEither(_) {
return Either_1.Right(this.__value);
return (0, Either_1.Right)(this.__value);
}

@@ -256,3 +256,3 @@ ifJust(effect) {

toEither(left) {
return Either_1.Left(left);
return (0, Either_1.Left)(left);
}

@@ -259,0 +259,0 @@ ifJust(_) {

@@ -1,2 +0,2 @@

import { Maybe } from './Maybe';
import { Maybe, MaybePatterns } from './Maybe';
import { EitherAsync } from './EitherAsync';

@@ -54,2 +54,5 @@ export interface MaybeAsyncTypeRef {

void(): MaybeAsync<void>;
/** Structural pattern matching for `MaybeAsync` in the form of a function */
caseOf<U>(patterns: MaybePatterns<T, U>): Promise<U>;
finally(effect: () => any): MaybeAsync<T>;
'fantasy-land/map'<U>(f: (value: T) => U): MaybeAsync<U>;

@@ -56,0 +59,0 @@ 'fantasy-land/chain'<U>(f: (value: T) => PromiseLike<Maybe<U>>): MaybeAsync<U>;

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

join() {
return exports.MaybeAsync(async (helpers) => {
return (0, exports.MaybeAsync)(async (helpers) => {
const maybe = await this.run();

@@ -44,3 +44,3 @@ if (maybe.isJust()) {

ap(maybeF) {
return exports.MaybeAsync(async (helpers) => {
return (0, exports.MaybeAsync)(async (helpers) => {
const otherValue = await maybeF;

@@ -60,3 +60,3 @@ if (otherValue.isJust()) {

alt(other) {
return exports.MaybeAsync(async (helpers) => {
return (0, exports.MaybeAsync)(async (helpers) => {
const thisValue = await this;

@@ -73,7 +73,7 @@ if (thisValue.isJust()) {

extend(f) {
return exports.MaybeAsync(async (helpers) => {
return (0, exports.MaybeAsync)(async (helpers) => {
const maybe = await this.run();
if (maybe.isJust()) {
const v = exports.MaybeAsync.liftMaybe(maybe);
return helpers.liftMaybe(Maybe_1.Just(f(v)));
return helpers.liftMaybe((0, Maybe_1.Just)(f(v)));
}

@@ -84,3 +84,3 @@ return helpers.liftMaybe(Maybe_1.Nothing);

filter(pred) {
return exports.MaybeAsync(async (helpers) => {
return (0, exports.MaybeAsync)(async (helpers) => {
const value = await this.run();

@@ -92,3 +92,3 @@ return helpers.liftMaybe(value.filter(pred));

try {
return Maybe_1.Just(await this.runPromise(helpers));
return (0, Maybe_1.Just)(await this.runPromise(helpers));
}

@@ -100,6 +100,6 @@ catch (_b) {

map(f) {
return exports.MaybeAsync((helpers) => this.runPromise(helpers).then(f));
return (0, exports.MaybeAsync)((helpers) => this.runPromise(helpers).then(f));
}
chain(f) {
return exports.MaybeAsync(async (helpers) => {
return (0, exports.MaybeAsync)(async (helpers) => {
const value = await this.runPromise(helpers);

@@ -110,3 +110,3 @@ return helpers.fromPromise(f(value));

toEitherAsync(error) {
return EitherAsync_1.EitherAsync(async ({ liftEither }) => {
return (0, EitherAsync_1.EitherAsync)(async ({ liftEither }) => {
const maybe = await this.run();

@@ -117,3 +117,3 @@ return liftEither(maybe.toEither(error));

ifJust(effect) {
return exports.MaybeAsync(async (helpers) => {
return (0, exports.MaybeAsync)(async (helpers) => {
const maybe = await this.run();

@@ -125,3 +125,3 @@ maybe.ifJust(effect);

ifNothing(effect) {
return exports.MaybeAsync(async (helpers) => {
return (0, exports.MaybeAsync)(async (helpers) => {
const maybe = await this.run();

@@ -135,2 +135,8 @@ maybe.ifNothing(effect);

}
caseOf(patterns) {
return this.run().then((x) => x.caseOf(patterns));
}
finally(effect) {
return (0, exports.MaybeAsync)(({ fromPromise }) => fromPromise(this.run().finally(effect)));
}
then(onfulfilled, onrejected) {

@@ -143,5 +149,5 @@ return this.run().then(onfulfilled, onrejected);

catMaybes: (list) => Promise.all(list).then(Maybe_1.Maybe.catMaybes),
fromPromise: (f) => exports.MaybeAsync(({ fromPromise: fP }) => fP(f())),
liftMaybe: (maybe) => exports.MaybeAsync(({ liftMaybe }) => liftMaybe(maybe))
fromPromise: (f) => (0, exports.MaybeAsync)(({ fromPromise: fP }) => fP(f())),
liftMaybe: (maybe) => (0, exports.MaybeAsync)(({ liftMaybe }) => liftMaybe(maybe))
});
MaybeAsyncImpl.prototype.constructor = exports.MaybeAsync;

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

reverse(this: NonEmptyList<T>): NonEmptyList<T>;
concat(...items: ConcatArray<T>[]): NonEmptyList<T>;
concat(...items: (T | ConcatArray<T>)[]): NonEmptyList<T>;
}

@@ -11,0 +13,0 @@ export interface NonEmptyListTypeRef {

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

exports.NonEmptyList = Object.assign(NonEmptyListConstructor, {
fromArray: (source) => exports.NonEmptyList.isNonEmpty(source) ? Maybe_1.Just(source) : Maybe_1.Nothing,
fromArray: (source) => exports.NonEmptyList.isNonEmpty(source) ? (0, Maybe_1.Just)(source) : Maybe_1.Nothing,
unsafeCoerce: (source) => {

@@ -15,3 +15,3 @@ if (exports.NonEmptyList.isNonEmpty(source)) {

},
fromTuple: (source) => exports.NonEmptyList(source.toArray()),
fromTuple: (source) => (0, exports.NonEmptyList)(source.toArray()),
head: (list) => list[0],

@@ -18,0 +18,0 @@ last: (list) => list[list.length - 1],

@@ -40,9 +40,9 @@ "use strict";

bimap(f, g) {
return exports.Tuple(f(this.first), g(this.second));
return (0, exports.Tuple)(f(this.first), g(this.second));
}
mapFirst(f) {
return exports.Tuple(f(this.first), this.second);
return (0, exports.Tuple)(f(this.first), this.second);
}
map(f) {
return exports.Tuple(this.first, f(this.second));
return (0, exports.Tuple)(this.first, f(this.second));
}

@@ -56,6 +56,6 @@ reduce(reducer, initialValue) {

swap() {
return exports.Tuple(this.second, this.first);
return (0, exports.Tuple)(this.second, this.first);
}
ap(f) {
return exports.Tuple(this.first, f.snd()(this.second));
return (0, exports.Tuple)(this.first, f.snd()(this.second));
}

@@ -71,3 +71,3 @@ every(pred) {

fromArray: ([fst, snd]) => {
return exports.Tuple(fst, snd);
return (0, exports.Tuple)(fst, snd);
},

@@ -78,3 +78,3 @@ fanout: (...args) => {

case 3:
return exports.Tuple(f(value), g(value));
return (0, exports.Tuple)(f(value), g(value));
case 2:

@@ -81,0 +81,0 @@ return (value) => exports.Tuple.fanout(f, g, value);

@@ -18,6 +18,10 @@ "use strict";

};
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};

@@ -76,5 +80,5 @@ Object.defineProperty(exports, "__esModule", { value: true });

? fn.apply(undefined, args)
: currify.bind.apply(currify, __spreadArray([undefined], __read(args)));
: currify.bind.apply(currify, __spreadArray([undefined], __read(args), false));
};
};
exports.curry = curry;

@@ -18,6 +18,10 @@ "use strict";

};
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};

@@ -31,19 +35,19 @@ Object.defineProperty(exports, "__esModule", { value: true });

var head = function (list) {
return list.length > 0 ? Maybe_1.Just(list[0]) : Maybe_1.Nothing;
return list.length > 0 ? (0, Maybe_1.Just)(list[0]) : Maybe_1.Nothing;
};
/** Returns Just the last element of an array or Nothing if there is none */
var last = function (list) {
return list.length > 0 ? Maybe_1.Just(list[list.length - 1]) : Maybe_1.Nothing;
return list.length > 0 ? (0, Maybe_1.Just)(list[list.length - 1]) : Maybe_1.Nothing;
};
/** Returns all elements of an array except the first */
var tail = function (list) {
return list.length > 0 ? Maybe_1.Just(list.slice(1)) : Maybe_1.Nothing;
return list.length > 0 ? (0, Maybe_1.Just)(list.slice(1)) : Maybe_1.Nothing;
};
/** Returns all elements of an array except the last */
var init = function (list) {
return list.length > 0 ? Maybe_1.Just(list.slice(0, -1)) : Maybe_1.Nothing;
return list.length > 0 ? (0, Maybe_1.Just)(list.slice(0, -1)) : Maybe_1.Nothing;
};
/** Returns a tuple of an array's head and tail */
var uncons = function (list) {
return list.length > 0 ? Maybe_1.Just(Tuple_1.Tuple(list[0], list.slice(1))) : Maybe_1.Nothing;
return list.length > 0 ? (0, Maybe_1.Just)((0, Tuple_1.Tuple)(list[0], list.slice(1))) : Maybe_1.Nothing;
};

@@ -73,3 +77,3 @@ /* Returns the sum of all numbers inside an array */

default:
return list[index] === undefined ? Maybe_1.Nothing : Maybe_1.Just(list[index]);
return list[index] === undefined ? Maybe_1.Nothing : (0, Maybe_1.Just)(list[index]);
}

@@ -82,3 +86,3 @@ }

default:
return __spreadArray([], __read(list)).sort(function (x, y) { return Function_1.orderToNumber(compare(x, y)); });
return __spreadArray([], __read(list), false).sort(function (x, y) { return (0, Function_1.orderToNumber)(compare(x, y)); });
}

@@ -85,0 +89,0 @@ }

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

Just.prototype.toEither = function (_) {
return Either_1.Right(this.__value);
return (0, Either_1.Right)(this.__value);
};

@@ -290,3 +290,3 @@ Just.prototype.ifJust = function (effect) {

Nothing.prototype.toEither = function (left) {
return Either_1.Left(left);
return (0, Either_1.Left)(left);
};

@@ -293,0 +293,0 @@ Nothing.prototype.ifJust = function (_) {

@@ -1,2 +0,2 @@

import { Maybe } from './Maybe';
import { Maybe, MaybePatterns } from './Maybe';
import { EitherAsync } from './EitherAsync';

@@ -54,2 +54,5 @@ export interface MaybeAsyncTypeRef {

void(): MaybeAsync<void>;
/** Structural pattern matching for `MaybeAsync` in the form of a function */
caseOf<U>(patterns: MaybePatterns<T, U>): Promise<U>;
finally(effect: () => any): MaybeAsync<T>;
'fantasy-land/map'<U>(f: (value: T) => U): MaybeAsync<U>;

@@ -56,0 +59,0 @@ 'fantasy-land/chain'<U>(f: (value: T) => PromiseLike<Maybe<U>>): MaybeAsync<U>;

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

var _this = this;
return exports.MaybeAsync(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
return (0, exports.MaybeAsync)(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
var maybe, nestedMaybe;

@@ -90,3 +90,3 @@ return __generator(this, function (_b) {

var _this = this;
return exports.MaybeAsync(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
return (0, exports.MaybeAsync)(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
var otherValue, thisValue;

@@ -116,3 +116,3 @@ return __generator(this, function (_b) {

var _this = this;
return exports.MaybeAsync(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
return (0, exports.MaybeAsync)(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
var thisValue, otherValue;

@@ -136,3 +136,3 @@ return __generator(this, function (_b) {

var _this = this;
return exports.MaybeAsync(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
return (0, exports.MaybeAsync)(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
var maybe, v;

@@ -146,3 +146,3 @@ return __generator(this, function (_b) {

v = exports.MaybeAsync.liftMaybe(maybe);
return [2 /*return*/, helpers.liftMaybe(Maybe_1.Just(f(v)))];
return [2 /*return*/, helpers.liftMaybe((0, Maybe_1.Just)(f(v)))];
}

@@ -156,3 +156,3 @@ return [2 /*return*/, helpers.liftMaybe(Maybe_1.Nothing)];

var _this = this;
return exports.MaybeAsync(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
return (0, exports.MaybeAsync)(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
var value;

@@ -189,7 +189,7 @@ return __generator(this, function (_b) {

var _this = this;
return exports.MaybeAsync(function (helpers) { return _this.runPromise(helpers).then(f); });
return (0, exports.MaybeAsync)(function (helpers) { return _this.runPromise(helpers).then(f); });
};
MaybeAsyncImpl.prototype.chain = function (f) {
var _this = this;
return exports.MaybeAsync(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
return (0, exports.MaybeAsync)(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
var value;

@@ -208,3 +208,3 @@ return __generator(this, function (_b) {

var _this = this;
return EitherAsync_1.EitherAsync(function (_b) {
return (0, EitherAsync_1.EitherAsync)(function (_b) {
var liftEither = _b.liftEither;

@@ -226,3 +226,3 @@ return __awaiter(_this, void 0, void 0, function () {

var _this = this;
return exports.MaybeAsync(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
return (0, exports.MaybeAsync)(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
var maybe;

@@ -242,3 +242,3 @@ return __generator(this, function (_b) {

var _this = this;
return exports.MaybeAsync(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
return (0, exports.MaybeAsync)(function (helpers) { return __awaiter(_this, void 0, void 0, function () {
var maybe;

@@ -259,2 +259,12 @@ return __generator(this, function (_b) {

};
MaybeAsyncImpl.prototype.caseOf = function (patterns) {
return this.run().then(function (x) { return x.caseOf(patterns); });
};
MaybeAsyncImpl.prototype.finally = function (effect) {
var _this = this;
return (0, exports.MaybeAsync)(function (_b) {
var fromPromise = _b.fromPromise;
return fromPromise(_this.run().finally(effect));
});
};
MaybeAsyncImpl.prototype.then = function (onfulfilled, onrejected) {

@@ -271,3 +281,3 @@ return this.run().then(onfulfilled, onrejected);

fromPromise: function (f) {
return exports.MaybeAsync(function (_b) {
return (0, exports.MaybeAsync)(function (_b) {
var fP = _b.fromPromise;

@@ -278,3 +288,3 @@ return fP(f());

liftMaybe: function (maybe) {
return exports.MaybeAsync(function (_b) {
return (0, exports.MaybeAsync)(function (_b) {
var liftMaybe = _b.liftMaybe;

@@ -281,0 +291,0 @@ return liftMaybe(maybe);

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

reverse(this: NonEmptyList<T>): NonEmptyList<T>;
concat(...items: ConcatArray<T>[]): NonEmptyList<T>;
concat(...items: (T | ConcatArray<T>)[]): NonEmptyList<T>;
}

@@ -11,0 +13,0 @@ export interface NonEmptyListTypeRef {

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

fromArray: function (source) {
return exports.NonEmptyList.isNonEmpty(source) ? Maybe_1.Just(source) : Maybe_1.Nothing;
return exports.NonEmptyList.isNonEmpty(source) ? (0, Maybe_1.Just)(source) : Maybe_1.Nothing;
},

@@ -18,3 +18,3 @@ unsafeCoerce: function (source) {

fromTuple: function (source) {
return exports.NonEmptyList(source.toArray());
return (0, exports.NonEmptyList)(source.toArray());
},

@@ -21,0 +21,0 @@ head: function (list) { return list[0]; },

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

@@ -31,14 +31,14 @@ "main": "index.js",

"devDependencies": {
"@types/jest": "26.0.24",
"ajv": "8.6.1",
"ajv-formats": "2.1.0",
"@types/jest": "27.0.2",
"ajv": "8.6.3",
"ajv-formats": "2.1.1",
"coveralls": "3.1.1",
"jest": "27.0.6",
"prettier": "2.3.2",
"ts-jest": "27.0.3",
"typescript": "4.3.5"
"jest": "27.2.4",
"prettier": "2.4.1",
"ts-jest": "27.0.5",
"typescript": "4.4.3"
},
"dependencies": {
"@types/json-schema": "7.0.8"
"@types/json-schema": "7.0.9"
}
}

@@ -92,9 +92,9 @@ "use strict";

TupleImpl.prototype.bimap = function (f, g) {
return exports.Tuple(f(this.first), g(this.second));
return (0, exports.Tuple)(f(this.first), g(this.second));
};
TupleImpl.prototype.mapFirst = function (f) {
return exports.Tuple(f(this.first), this.second);
return (0, exports.Tuple)(f(this.first), this.second);
};
TupleImpl.prototype.map = function (f) {
return exports.Tuple(this.first, f(this.second));
return (0, exports.Tuple)(this.first, f(this.second));
};

@@ -108,6 +108,6 @@ TupleImpl.prototype.reduce = function (reducer, initialValue) {

TupleImpl.prototype.swap = function () {
return exports.Tuple(this.second, this.first);
return (0, exports.Tuple)(this.second, this.first);
};
TupleImpl.prototype.ap = function (f) {
return exports.Tuple(this.first, f.snd()(this.second));
return (0, exports.Tuple)(this.first, f.snd()(this.second));
};

@@ -125,3 +125,3 @@ TupleImpl.prototype.every = function (pred) {

var _b = __read(_a, 2), fst = _b[0], snd = _b[1];
return exports.Tuple(fst, snd);
return (0, exports.Tuple)(fst, snd);
},

@@ -136,3 +136,3 @@ fanout: function () {

case 3:
return exports.Tuple(f(value), g(value));
return (0, exports.Tuple)(f(value), g(value));
case 2:

@@ -139,0 +139,0 @@ return function (value) { return exports.Tuple.fanout(f, g, value); };

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