Socket
Socket
Sign inDemoInstall

@fp-ts/data

Package Overview
Dependencies
Maintainers
3
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fp-ts/data - npm Package Compare versions

Comparing version 0.0.10 to 0.0.12

_mjs/Json.mjs

57

Either.d.ts

@@ -35,2 +35,3 @@ /**

import * as traversable from "@fp-ts/core/typeclass/Traversable";
import type { LazyArg } from "@fp-ts/data/Function";
import type { Option } from "@fp-ts/data/Option";

@@ -42,6 +43,6 @@ import type { Predicate, Refinement } from "@fp-ts/data/Predicate";

*/
export interface Left<E> {
export declare type Left<E> = {
readonly _tag: "Left";
readonly left: E;
}
};
/**

@@ -51,6 +52,6 @@ * @category models

*/
export interface Right<A> {
export declare type Right<A> = {
readonly _tag: "Right";
readonly right: A;
}
};
/**

@@ -397,3 +398,3 @@ * @category models

* E.right(1),
* E.getOrElse(0)
* E.getOrElse(() => 0)
* ),

@@ -405,3 +406,3 @@ * 1

* E.left('error'),
* E.getOrElse(0)
* E.getOrElse(() => 0)
* ),

@@ -414,3 +415,3 @@ * 0

*/
export declare const getOrElse: <B>(onLeft: B) => <E, A>(self: Either<E, A>) => B | A;
export declare const getOrElse: <B>(onLeft: LazyArg<B>) => <E, A>(self: Either<E, A>) => B | A;
/**

@@ -453,3 +454,3 @@ * Recovers from all errors.

*/
export declare const orElseFail: <E2>(onLeft: E2) => <E1, A>(self: Either<E1, A>) => Either<E2, A>;
export declare const orElseFail: <E2>(onLeft: LazyArg<E2>) => <E1, A>(self: Either<E1, A>) => Either<E2, A>;
/**

@@ -462,3 +463,3 @@ * Executes this effect and returns its value, if it succeeds, but otherwise

*/
export declare const orElseSucceed: <B>(onLeft: B) => <E, A>(self: Either<E, A>) => Either<E, B | A>;
export declare const orElseSucceed: <B>(onLeft: LazyArg<B>) => <E, A>(self: Either<E, A>) => Either<E, B | A>;
/**

@@ -512,6 +513,6 @@ * @category instances

*
* const parse = E.fromNullable('nully')
* const parse = E.fromNullable(() => 'nullable')
*
* assert.deepStrictEqual(parse(1), E.right(1))
* assert.deepStrictEqual(parse(null), E.left('nully'))
* assert.deepStrictEqual(parse(null), E.left('nullable'))
*

@@ -521,3 +522,3 @@ * @category conversions

*/
export declare const fromNullable: <E>(onNullable: E) => <A>(a: A) => Either<E, NonNullable<A>>;
export declare const fromNullable: <E>(onNullable: LazyArg<E>) => <A>(a: A) => Either<E, NonNullable<A>>;
/**

@@ -527,3 +528,3 @@ * @category lifting

*/
export declare const liftNullable: <A extends readonly unknown[], B, E>(f: (...a: A) => B | null | undefined, onNullable: E) => (...a: A) => Either<E, NonNullable<B>>;
export declare const liftNullable: <A extends readonly unknown[], B, E>(f: (...a: A) => B | null | undefined, onNullable: (...a: A) => E) => (...a: A) => Either<E, NonNullable<B>>;
/**

@@ -533,3 +534,3 @@ * @category sequencing

*/
export declare const flatMapNullable: <A, B, E2>(f: (a: A) => B | null | undefined, onNullable: E2) => <E1>(self: Either<E1, A>) => Either<E2 | E1, NonNullable<B>>;
export declare const flatMapNullable: <A, B, E2>(f: (a: A) => B | null | undefined, onNullable: (a: A) => E2) => <E1>(self: Either<E1, A>) => Either<E2 | E1, NonNullable<B>>;
/**

@@ -594,3 +595,3 @@ * Returns a `Refinement` from a `Either` returning function.

*/
export declare const compact: <E2>(onNone: E2) => <E1, A>(self: Either<E1, Option<A>>) => Either<E2 | E1, A>;
export declare const compact: <E2>(onNone: LazyArg<E2>) => <E1, A>(self: Either<E1, Option<A>>) => Either<E2 | E1, A>;
/**

@@ -601,4 +602,4 @@ * @category filtering

export declare const filter: {
<C extends A, B extends A, E2, A = C>(refinement: Refinement<A, B>, onFalse: E2): <E1>(self: Either<E1, C>) => Either<E1 | E2, B>;
<B extends A, E2, A = B>(predicate: Predicate<A>, onFalse: E2): <E1>(self: Either<E1, B>) => Either<E1 | E2, B>;
<C extends A, B extends A, E2, A = C>(refinement: Refinement<A, B>, onFalse: LazyArg<E2>): <E1>(self: Either<E1, C>) => Either<E1 | E2, B>;
<B extends A, E2, A = B>(predicate: Predicate<A>, onFalse: LazyArg<E2>): <E1>(self: Either<E1, B>) => Either<E1 | E2, B>;
};

@@ -609,3 +610,3 @@ /**

*/
export declare const filterMap: <A, B, E2>(f: (a: A) => Option<B>, onNone: E2) => <E1>(self: Either<E1, A>) => Either<E2 | E1, B>;
export declare const filterMap: <A, B, E2>(f: (a: A) => Option<B>, onNone: LazyArg<E2>) => <E1>(self: Either<E1, A>) => Either<E2 | E1, B>;
/**

@@ -658,3 +659,3 @@ * @category traversing

*/
export declare const fromIterable: <E>(onEmpty: E) => <A>(collection: Iterable<A>) => Either<E, A>;
export declare const fromIterable: <E>(onEmpty: LazyArg<E>) => <A>(collection: Iterable<A>) => Either<E, A>;
/**

@@ -666,4 +667,4 @@ * @example

*
* assert.deepStrictEqual(pipe(O.some(1), E.fromOption('error')), E.right(1))
* assert.deepStrictEqual(pipe(O.none, E.fromOption('error')), E.left('error'))
* assert.deepStrictEqual(pipe(O.some(1), E.fromOption(() => 'error')), E.right(1))
* assert.deepStrictEqual(pipe(O.none, E.fromOption(() => 'error')), E.left('error'))
*

@@ -673,3 +674,3 @@ * @category conversions

*/
export declare const fromOption: <E>(onNone: E) => <A>(self: Option<A>) => Either<E, A>;
export declare const fromOption: <E>(onNone: LazyArg<E>) => <A>(self: Option<A>) => Either<E, A>;
/**

@@ -721,3 +722,3 @@ * Converts a `Either` to an `Option` discarding the Right.

* 1,
* liftPredicate((n) => n > 0, 'error')
* liftPredicate((n) => n > 0, () => 'error')
* ),

@@ -729,3 +730,3 @@ * right(1)

* -1,
* liftPredicate((n) => n > 0, 'error')
* liftPredicate((n) => n > 0, () => 'error')
* ),

@@ -739,4 +740,4 @@ * left('error')

export declare const liftPredicate: {
<C extends A, B extends A, E, A = C>(refinement: Refinement<A, B>, onFalse: E): (c: C) => Either<E, B>;
<B extends A, E, A = B>(predicate: Predicate<A>, onFalse: E): (b: B) => Either<E, B>;
<C extends A, B extends A, E, A = C>(refinement: Refinement<A, B>, onFalse: LazyArg<E>): (c: C) => Either<E, B>;
<B extends A, E, A = B>(predicate: Predicate<A>, onFalse: LazyArg<E>): (b: B) => Either<E, B>;
};

@@ -747,3 +748,3 @@ /**

*/
export declare const liftOption: <A extends readonly unknown[], B, E>(f: (...a: A) => Option<B>, onNone: E) => (...a: A) => Either<E, B>;
export declare const liftOption: <A extends readonly unknown[], B, E>(f: (...a: A) => Option<B>, onNone: (...a: A) => E) => (...a: A) => Either<E, B>;
/**

@@ -753,3 +754,3 @@ * @category sequencing

*/
export declare const flatMapOption: <A, B, E2>(f: (a: A) => Option<B>, onNone: E2) => <E1>(self: Either<E1, A>) => Either<E2 | E1, B>;
export declare const flatMapOption: <A, B, E2>(f: (a: A) => Option<B>, onNone: (a: A) => E2) => <E1>(self: Either<E1, A>) => Either<E2 | E1, B>;
/**

@@ -756,0 +757,0 @@ * Tests whether a value is a member of a `Either`.

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

* E.right(1),
* E.getOrElse(0)
* E.getOrElse(() => 0)
* ),

@@ -542,3 +542,3 @@ * 1

* E.left('error'),
* E.getOrElse(0)
* E.getOrElse(() => 0)
* ),

@@ -554,3 +554,3 @@ * 0

const getOrElse = onLeft => self => isLeft(self) ? onLeft : self.right;
const getOrElse = onLeft => self => isLeft(self) ? onLeft() : self.right;
/**

@@ -609,3 +609,3 @@ * Recovers from all errors.

const orElseFail = onLeft => orElse(left(onLeft));
const orElseFail = onLeft => catchAll(() => left(onLeft()));
/**

@@ -622,3 +622,3 @@ * Executes this effect and returns its value, if it succeeds, but otherwise

const orElseSucceed = onLeft => orElse(right(onLeft));
const orElseSucceed = onLeft => catchAll(() => right(onLeft()));
/**

@@ -684,6 +684,6 @@ * @category instances

*
* const parse = E.fromNullable('nully')
* const parse = E.fromNullable(() => 'nullable')
*
* assert.deepStrictEqual(parse(1), E.right(1))
* assert.deepStrictEqual(parse(null), E.left('nully'))
* assert.deepStrictEqual(parse(null), E.left('nullable'))
*

@@ -704,3 +704,3 @@ * @category conversions

const liftNullable = (f, onNullable) => (...a) => fromNullable(onNullable)(f(...a));
const liftNullable = (f, onNullable) => (...a) => fromNullable(() => onNullable(...a))(f(...a));
/**

@@ -812,3 +812,3 @@ * @category sequencing

const compact = onNone => self => isLeft(self) ? self : option.isNone(self.right) ? left(onNone) : right(self.right.value);
const compact = onNone => self => isLeft(self) ? self : option.isNone(self.right) ? left(onNone()) : right(self.right.value);
/**

@@ -822,3 +822,3 @@ * @category filtering

const filter = (predicate, onFalse) => self => isLeft(self) ? self : predicate(self.right) ? self : left(onFalse);
const filter = (predicate, onFalse) => self => isLeft(self) ? self : predicate(self.right) ? self : left(onFalse());
/**

@@ -834,3 +834,3 @@ * @category filtering

const ob = f(a);
return option.isNone(ob) ? left(onNone) : right(ob.value);
return option.isNone(ob) ? left(onNone()) : right(ob.value);
}));

@@ -939,3 +939,3 @@ /**

return left(onEmpty);
return left(onEmpty());
};

@@ -948,4 +948,4 @@ /**

*
* assert.deepStrictEqual(pipe(O.some(1), E.fromOption('error')), E.right(1))
* assert.deepStrictEqual(pipe(O.none, E.fromOption('error')), E.left('error'))
* assert.deepStrictEqual(pipe(O.some(1), E.fromOption(() => 'error')), E.right(1))
* assert.deepStrictEqual(pipe(O.none, E.fromOption(() => 'error')), E.left('error'))
*

@@ -997,3 +997,3 @@ * @category conversions

exports.getRight = getRight;
const getOrNull = /*#__PURE__*/getOrElse(null);
const getOrNull = /*#__PURE__*/getOrElse(_Function.constNull);
/**

@@ -1005,3 +1005,3 @@ * @category getters

exports.getOrNull = getOrNull;
const getOrUndefined = /*#__PURE__*/getOrElse(undefined);
const getOrUndefined = /*#__PURE__*/getOrElse(_Function.constUndefined);
/**

@@ -1015,3 +1015,3 @@ * @example

* 1,
* liftPredicate((n) => n > 0, 'error')
* liftPredicate((n) => n > 0, () => 'error')
* ),

@@ -1023,3 +1023,3 @@ * right(1)

* -1,
* liftPredicate((n) => n > 0, 'error')
* liftPredicate((n) => n > 0, () => 'error')
* ),

@@ -1035,3 +1035,3 @@ * left('error')

const liftPredicate = (predicate, onFalse) => b => predicate(b) ? right(b) : left(onFalse);
const liftPredicate = (predicate, onFalse) => b => predicate(b) ? right(b) : left(onFalse());
/**

@@ -1045,3 +1045,3 @@ * @category lifting

const liftOption = (f, onNone) => (...a) => fromOption(onNone)(f(...a));
const liftOption = (f, onNone) => (...a) => fromOption(() => onNone(...a))(f(...a));
/**

@@ -1048,0 +1048,0 @@ * @category sequencing

@@ -20,2 +20,3 @@ /**

import * as identity from "@fp-ts/data/Identity";
import * as json from "@fp-ts/data/Json";
import * as list from "@fp-ts/data/List";

@@ -118,2 +119,6 @@ import * as mutableHashMap from "@fp-ts/data/mutable/MutableHashMap";

*/
json,
/**
* @since 1.0.0
*/
list,

@@ -120,0 +125,0 @@ /**

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

});
exports.weakIterableMap = exports.these = exports.string = exports.sortedSet = exports.sortedMap = exports.seq = exports.safeEval = exports.redBlackTree = exports.readonlyArray = exports.random = exports.queue = exports.predicate = exports.ordering = exports.orPatch = exports.option = exports.number = exports.nonEmpty = exports.mutableRef = exports.mutableQueue = exports.mutableListBuilder = exports.mutableList = exports.mutableHashSet = exports.mutableHashMap = exports.list = exports.identity = exports.hashSetPatch = exports.hashSet = exports.hashMapPatch = exports.hashMap = exports.function = exports.filterableWithIndex = exports.equal = exports.either = exports.duration = exports.differ = exports.covariantWithIndex = exports.contextPatch = exports.context = exports.chunkPatch = exports.chunk = exports.boolean = void 0;
exports.weakIterableMap = exports.these = exports.string = exports.sortedSet = exports.sortedMap = exports.seq = exports.safeEval = exports.redBlackTree = exports.readonlyArray = exports.random = exports.queue = exports.predicate = exports.ordering = exports.orPatch = exports.option = exports.number = exports.nonEmpty = exports.mutableRef = exports.mutableQueue = exports.mutableListBuilder = exports.mutableList = exports.mutableHashSet = exports.mutableHashMap = exports.list = exports.json = exports.identity = exports.hashSetPatch = exports.hashSet = exports.hashMapPatch = exports.hashMap = exports.function = exports.filterableWithIndex = exports.equal = exports.either = exports.duration = exports.differ = exports.covariantWithIndex = exports.contextPatch = exports.context = exports.chunkPatch = exports.chunk = exports.boolean = void 0;

@@ -73,2 +73,6 @@ var boolean = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/data/Boolean"));

var json = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/data/Json"));
exports.json = json;
var list = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/data/List"));

@@ -75,0 +79,0 @@

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

for (const k of this.unsafeMap.keys()) {
if (!that.unsafeMap.has(k)) {
if (!that.unsafeMap.has(k) || !Equal.equals(this.unsafeMap.get(k), that.unsafeMap.get(k))) {
return false;

@@ -112,0 +112,0 @@ }

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

const fromNullable = onNullable => a => a == null ? left(onNullable) : right(a);
const fromNullable = onNullable => a => a == null ? left(onNullable()) : right(a);
/** @internal */

@@ -70,5 +70,5 @@

const fromOption = onNone => fa => option.isNone(fa) ? left(onNone) : right(fa.value);
const fromOption = onNone => fa => option.isNone(fa) ? left(onNone()) : right(fa.value);
exports.fromOption = fromOption;
//# sourceMappingURL=Either.js.map

@@ -45,5 +45,5 @@ /**

*/
export interface None {
export declare type None = {
readonly _tag: "None";
}
};
/**

@@ -53,6 +53,6 @@ * @category models

*/
export interface Some<A> {
export declare type Some<A> = {
readonly _tag: "Some";
readonly value: A;
}
};
/**

@@ -150,3 +150,3 @@ * @category models

*/
export declare const getOrThrow: (onError: unknown) => <A>(self: Option<A>) => A;
export declare const getOrThrow: (onError: LazyArg<unknown>) => <A>(self: Option<A>) => A;
/**

@@ -576,3 +576,3 @@ * Returns an effect whose success is mapped by the specified `f` function.

*/
export declare const toEither: <E>(onNone: E) => <A>(self: Option<A>) => Either<E, A>;
export declare const toEither: <E>(onNone: LazyArg<E>) => <A>(self: Option<A>) => Either<E, A>;
/**

@@ -589,3 +589,3 @@ * Takes a (lazy) default value, a function, and an `Option` value, if the `Option` value is `None` the default value is

* some(1),
* match('a none', a => `a some containing ${a}`)
* match(() => 'a none', a => `a some containing ${a}`)
* ),

@@ -598,3 +598,3 @@ * 'a some containing 1'

* none,
* match('a none', a => `a some containing ${a}`)
* match(() => 'a none', a => `a some containing ${a}`)
* ),

@@ -607,3 +607,3 @@ * 'a none'

*/
export declare const match: <B, A, C = B>(onNone: B, onSome: (a: A) => C) => (self: Option<A>) => B | C;
export declare const match: <B, A, C = B>(onNone: LazyArg<B>, onSome: (a: A) => C) => (self: Option<A>) => B | C;
/**

@@ -616,4 +616,4 @@ * Extracts the value out of the structure, if it exists. Otherwise returns the given default value

*
* assert.strictEqual(pipe(some(1), getOrElse(0)), 1)
* assert.strictEqual(pipe(none, getOrElse(0)), 0)
* assert.strictEqual(pipe(some(1), getOrElse(() => 0)), 1)
* assert.strictEqual(pipe(none, getOrElse(() => 0)), 0)
*

@@ -623,3 +623,3 @@ * @category error handling

*/
export declare const getOrElse: <B>(onNone: B) => <A>(self: Option<A>) => B | A;
export declare const getOrElse: <B>(onNone: LazyArg<B>) => <A>(self: Option<A>) => B | A;
/**

@@ -790,3 +790,3 @@ * Returns a *smart constructor* from a function that returns a nullable value.

*/
export declare const orElseSucceed: <B>(onNone: B) => <A>(self: Option<A>) => Option<B | A>;
export declare const orElseSucceed: <B>(onNone: () => B) => <A>(self: Option<A>) => Option<B | A>;
/**

@@ -793,0 +793,0 @@ * The `Order` instance allows `Option` values to be compared with

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

throw onError;
throw onError();
};

@@ -888,3 +888,3 @@ /**

* some(1),
* match('a none', a => `a some containing ${a}`)
* match(() => 'a none', a => `a some containing ${a}`)
* ),

@@ -897,3 +897,3 @@ * 'a some containing 1'

* none,
* match('a none', a => `a some containing ${a}`)
* match(() => 'a none', a => `a some containing ${a}`)
* ),

@@ -909,3 +909,3 @@ * 'a none'

const match = (onNone, onSome) => self => isNone(self) ? onNone : onSome(self.value);
const match = (onNone, onSome) => self => isNone(self) ? onNone() : onSome(self.value);
/**

@@ -918,4 +918,4 @@ * Extracts the value out of the structure, if it exists. Otherwise returns the given default value

*
* assert.strictEqual(pipe(some(1), getOrElse(0)), 1)
* assert.strictEqual(pipe(none, getOrElse(0)), 0)
* assert.strictEqual(pipe(some(1), getOrElse(() => 0)), 1)
* assert.strictEqual(pipe(none, getOrElse(() => 0)), 0)
*

@@ -929,3 +929,3 @@ * @category error handling

const getOrElse = onNone => self => isNone(self) ? onNone : self.value;
const getOrElse = onNone => self => isNone(self) ? onNone() : self.value;
/**

@@ -1020,3 +1020,3 @@ * Returns a *smart constructor* from a function that returns a nullable value.

exports.flatMapNullable = flatMapNullable;
const getOrNull = /*#__PURE__*/getOrElse(null);
const getOrNull = /*#__PURE__*/getOrElse(_Function.constNull);
/**

@@ -1037,3 +1037,3 @@ * Extracts the value out of the structure, if it exists. Otherwise returns `undefined`.

exports.getOrNull = getOrNull;
const getOrUndefined = /*#__PURE__*/getOrElse(undefined);
const getOrUndefined = /*#__PURE__*/getOrElse(_Function.constUndefined);
/**

@@ -1126,3 +1126,3 @@ * Lazy version of `orElse`.

const orElseSucceed = onNone => orElse(some(onNone));
const orElseSucceed = onNone => catchAll(() => some(onNone()));
/**

@@ -1129,0 +1129,0 @@ * The `Order` instance allows `Option` values to be compared with

{
"name": "@fp-ts/data",
"version": "0.0.10",
"version": "0.0.12",
"license": "MIT",

@@ -5,0 +5,0 @@ "repository": {

@@ -43,2 +43,3 @@ /**

import type { Either, Left, Right } from "@fp-ts/data/Either";
import type { LazyArg } from "@fp-ts/data/Function";
import type { Option } from "@fp-ts/data/Option";

@@ -50,7 +51,7 @@ import type { Predicate, Refinement } from "@fp-ts/data/Predicate";

*/
export interface Both<E, A> {
export declare type Both<E, A> = {
readonly _tag: "Both";
readonly left: E;
readonly right: A;
}
};
/**

@@ -123,3 +124,3 @@ * @category model

*/
export declare const leftOrBoth: <E>(e: E) => <A>(self: Option<A>) => These<E, A>;
export declare const leftOrBoth: <E>(e: LazyArg<E>) => <A>(self: Option<A>) => These<E, A>;
/**

@@ -129,3 +130,3 @@ * @category constructors

*/
export declare const rightOrBoth: <A>(a: A) => <E>(self: Option<E>) => These<E, A>;
export declare const rightOrBoth: <A>(a: () => A) => <E>(self: Option<E>) => These<E, A>;
/**

@@ -207,3 +208,3 @@ * @category pattern matching

*/
export declare const fromNullable: <E>(onNullable: E) => <A>(a: A) => These<E, NonNullable<A>>;
export declare const fromNullable: <E>(onNullable: LazyArg<E>) => <A>(a: A) => These<E, NonNullable<A>>;
/**

@@ -233,3 +234,3 @@ * @category conversions

*/
export declare const liftNullable: <A extends readonly unknown[], B, E>(f: (...a: A) => B | null | undefined, onNullable: E) => (...a: A) => These<E, NonNullable<B>>;
export declare const liftNullable: <A extends readonly unknown[], B, E>(f: (...a: A) => B | null | undefined, onNullable: (...a: A) => E) => (...a: A) => These<E, NonNullable<B>>;
/**

@@ -239,3 +240,3 @@ * @category sequencing

*/
export declare const flatMapNullable: <A, B, E2>(f: (a: A) => B | null | undefined, onNullable: E2) => <E1>(self: Validated<E1, A>) => Validated<E2 | E1, NonNullable<B>>;
export declare const flatMapNullable: <A, B, E2>(f: (a: A) => B | null | undefined, onNullable: (a: A) => E2) => <E1>(self: Validated<E1, A>) => Validated<E2 | E1, NonNullable<B>>;
/**

@@ -246,4 +247,4 @@ * @category lifting

export declare const liftPredicate: {
<C extends A, B extends A, E, A = C>(refinement: Refinement<A, B>, onFalse: E): (c: C) => These<E, B>;
<B extends A, E, A = B>(predicate: Predicate<A>, onFalse: E): (b: B) => These<E, B>;
<C extends A, B extends A, E, A = C>(refinement: Refinement<A, B>, onFalse: LazyArg<E>): (c: C) => These<E, B>;
<B extends A, E, A = B>(predicate: Predicate<A>, onFalse: LazyArg<E>): (b: B) => These<E, B>;
};

@@ -254,3 +255,3 @@ /**

*/
export declare const fromIterable: <E>(onEmpty: E) => <A>(collection: Iterable<A>) => These<E, A>;
export declare const fromIterable: <E>(onEmpty: LazyArg<E>) => <A>(collection: Iterable<A>) => These<E, A>;
/**

@@ -260,3 +261,3 @@ * @category conversions

*/
export declare const fromOption: <E>(onNone: E) => <A>(self: Option<A>) => These<E, A>;
export declare const fromOption: <E>(onNone: LazyArg<E>) => <A>(self: Option<A>) => These<E, A>;
/**

@@ -271,3 +272,3 @@ * @category conversions

*/
export declare const liftOption: <A extends readonly unknown[], B, E>(f: (...a: A) => Option<B>, onNone: E) => (...a: A) => These<E, B>;
export declare const liftOption: <A extends readonly unknown[], B, E>(f: (...a: A) => Option<B>, onNone: (...a: A) => E) => (...a: A) => These<E, B>;
/**

@@ -287,3 +288,3 @@ * @category lifting

*/
export declare const flatMapOption: <A, B, E2>(f: (a: A) => Option<B>, onNone: E2) => <E1>(self: Validated<E1, A>) => Validated<E2 | E1, B>;
export declare const flatMapOption: <A, B, E2>(f: (a: A) => Option<B>, onNone: (a: A) => E2) => <E1>(self: Validated<E1, A>) => Validated<E2 | E1, B>;
/**

@@ -332,3 +333,3 @@ * @category sequencing

*/
export declare const getBothOrElse: <E, A>(e: E, a: A) => (self: These<E, A>) => readonly [E, A];
export declare const getBothOrElse: <E, A>(e: LazyArg<E>, a: LazyArg<A>) => (self: These<E, A>) => readonly [E, A];
/**

@@ -338,3 +339,3 @@ * @category getters

*/
export declare const getOrElse: <B>(onLeft: B) => <E, A>(self: These<E, A>) => B | A;
export declare const getOrElse: <B>(onLeft: LazyArg<B>) => <E, A>(self: These<E, A>) => B | A;
/**

@@ -542,3 +543,3 @@ * @category getters

*/
export declare const orElseFail: <E2>(onLeft: E2) => <E1, A>(self: These<E1, A>) => These<E2 | E1, A>;
export declare const orElseFail: <E2>(onLeft: LazyArg<E2>) => <E1, A>(self: These<E1, A>) => These<E2 | E1, A>;
/**

@@ -551,3 +552,3 @@ * Executes this effect and returns its value, if it succeeds, but otherwise

*/
export declare const orElseSucceed: <B>(onLeft: B) => <E, A>(self: These<E, A>) => These<E, B | A>;
export declare const orElseSucceed: <B>(onLeft: LazyArg<B>) => <E, A>(self: These<E, A>) => These<E, B | A>;
/**

@@ -577,3 +578,3 @@ * @category error handling

*/
export declare const compact: <E>(onNone: E) => <A>(self: These<E, Option<A>>) => These<E, A>;
export declare const compact: <E>(onNone: LazyArg<E>) => <A>(self: These<E, Option<A>>) => These<E, A>;
/**

@@ -584,4 +585,4 @@ * @category filtering

export declare const filter: {
<C extends A, B extends A, E2, A = C>(refinement: Refinement<A, B>, onFalse: E2): <E1>(self: These<E1, C>) => These<E1 | E2, B>;
<B extends A, E2, A = B>(predicate: Predicate<A>, onFalse: E2): <E1>(self: These<E1, B>) => These<E1 | E2, B>;
<C extends A, B extends A, E2, A = C>(refinement: Refinement<A, B>, onFalse: LazyArg<E2>): <E1>(self: These<E1, C>) => These<E1 | E2, B>;
<B extends A, E2, A = B>(predicate: Predicate<A>, onFalse: LazyArg<E2>): <E1>(self: These<E1, B>) => These<E1 | E2, B>;
};

@@ -592,3 +593,3 @@ /**

*/
export declare const filterMap: <A, B, E2>(f: (a: A) => Option<B>, onNone: E2) => <E1>(self: These<E1, A>) => These<E2 | E1, B>;
export declare const filterMap: <A, B, E2>(f: (a: A) => Option<B>, onNone: LazyArg<E2>) => <E1>(self: These<E1, A>) => These<E2 | E1, B>;
/**

@@ -595,0 +596,0 @@ * @since 1.0.0

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

const leftOrBoth = e => self => option.isNone(self) ? left(e) : both(e, self.value);
const leftOrBoth = e => self => option.isNone(self) ? left(e()) : both(e(), self.value);
/**

@@ -136,3 +136,3 @@ * @category constructors

const rightOrBoth = a => self => option.isNone(self) ? right(a) : both(self.value, a);
const rightOrBoth = a => self => option.isNone(self) ? right(a()) : both(self.value, a());
/**

@@ -291,3 +291,3 @@ * @category pattern matching

const fromNullable = onNullable => a => a == null ? left(onNullable) : right(a);
const fromNullable = onNullable => a => a == null ? left(onNullable()) : right(a);
/**

@@ -333,3 +333,3 @@ * @category conversions

const liftNullable = (f, onNullable) => (...a) => fromNullable(onNullable)(f(...a));
const liftNullable = (f, onNullable) => (...a) => fromNullable(() => onNullable(...a))(f(...a));
/**

@@ -343,3 +343,3 @@ * @category sequencing

const flatMapNullable = (f, onNullable) => flatMap(liftNullable(f, chunk.singleton(onNullable)));
const flatMapNullable = (f, onNullable) => flatMap(liftNullable(f, a => chunk.singleton(onNullable(a))));
/**

@@ -353,3 +353,3 @@ * @category lifting

const liftPredicate = (predicate, onFalse) => b => predicate(b) ? right(b) : left(onFalse);
const liftPredicate = (predicate, onFalse) => b => predicate(b) ? right(b) : left(onFalse());
/**

@@ -368,3 +368,3 @@ * @category conversions

return left(onEmpty);
return left(onEmpty());
};

@@ -379,3 +379,3 @@ /**

const fromOption = onNone => self => option.isNone(self) ? left(onNone) : right(self.value);
const fromOption = onNone => self => option.isNone(self) ? left(onNone()) : right(self.value);
/**

@@ -398,3 +398,3 @@ * @category conversions

const liftOption = (f, onNone) => (...a) => fromOption(onNone)(f(...a));
const liftOption = (f, onNone) => (...a) => fromOption(() => onNone(...a))(f(...a));
/**

@@ -426,3 +426,3 @@ * @category lifting

const flatMapOption = (f, onNone) => self => (0, _Function.pipe)(self, flatMap(liftOption(f, chunk.singleton(onNone))));
const flatMapOption = (f, onNone) => self => (0, _Function.pipe)(self, flatMap(liftOption(f, a => chunk.singleton(onNone(a)))));
/**

@@ -503,3 +503,3 @@ * @category sequencing

const getBothOrElse = (e, a) => self => isLeft(self) ? [self.left, a] : isRight(self) ? [e, self.right] : [self.left, self.right];
const getBothOrElse = (e, a) => self => isLeft(self) ? [self.left, a()] : isRight(self) ? [e(), self.right] : [self.left, self.right];
/**

@@ -513,3 +513,3 @@ * @category getters

const getOrElse = onLeft => self => isLeft(self) ? onLeft : self.right;
const getOrElse = onLeft => self => isLeft(self) ? onLeft() : self.right;
/**

@@ -522,3 +522,3 @@ * @category getters

exports.getOrElse = getOrElse;
const getOrNull = /*#__PURE__*/getOrElse(null);
const getOrNull = /*#__PURE__*/getOrElse(_Function.constNull);
/**

@@ -530,3 +530,3 @@ * @category getters

exports.getOrNull = getOrNull;
const getOrUndefined = /*#__PURE__*/getOrElse(undefined);
const getOrUndefined = /*#__PURE__*/getOrElse(_Function.constUndefined);
/**

@@ -839,3 +839,3 @@ * @category debugging

const orElseFail = onLeft => orElse(left(onLeft));
const orElseFail = onLeft => catchAll(() => left(onLeft()));
/**

@@ -852,3 +852,3 @@ * Executes this effect and returns its value, if it succeeds, but otherwise

const orElseSucceed = onLeft => orElse(right(onLeft));
const orElseSucceed = onLeft => catchAll(() => right(onLeft()));
/**

@@ -911,3 +911,3 @@ * @category error handling

const compact = onNone => self => isLeft(self) ? self : option.isNone(self.right) ? left(onNone) : isBoth(self) ? both(self.left, self.right.value) : right(self.right.value);
const compact = onNone => self => isLeft(self) ? self : option.isNone(self.right) ? left(onNone()) : isBoth(self) ? both(self.left, self.right.value) : right(self.right.value);
/**

@@ -921,3 +921,3 @@ * @category filtering

const filter = (predicate, onFalse) => self => isLeft(self) ? self : predicate(self.right) ? self : left(onFalse);
const filter = (predicate, onFalse) => self => isLeft(self) ? self : predicate(self.right) ? self : left(onFalse());
/**

@@ -938,7 +938,7 @@ * @category filtering

const ob = f(self.right);
return option.isNone(ob) ? left(onNone) : right(ob.value);
return option.isNone(ob) ? left(onNone()) : right(ob.value);
}
const ob = f(self.right);
return option.isNone(ob) ? left(onNone) : both(self.left, ob.value);
return option.isNone(ob) ? left(onNone()) : both(self.left, ob.value);
};

@@ -945,0 +945,0 @@ /**

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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