veffect
Version:
powerful TypeScript validation library built on the robust foundation of Effect combining exceptional type safety, high performance, and developer experience. Taking inspiration from Effect's functional principles, VEffect delivers a balanced approach tha
179 lines (178 loc) • 4.84 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.tap = exports.of = exports.matchEffect = exports.match = exports.map = exports.make = exports.isSuccess = exports.isFailure = exports.isDone = exports.fromPull = exports.fromExit = exports.fromEffect = exports.failCause = exports.fail = exports.end = exports.done = exports.dieMessage = exports.die = exports.chunk = exports.TakeTypeId = void 0;
var internal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("./internal/take.js"));
function _getRequireWildcardCache(e) {
if ("function" != typeof WeakMap) return null;
var r = new WeakMap(),
t = new WeakMap();
return (_getRequireWildcardCache = function (e) {
return e ? t : r;
})(e);
}
function _interopRequireWildcard(e, r) {
if (!r && e && e.__esModule) return e;
if (null === e || "object" != typeof e && "function" != typeof e) return {
default: e
};
var t = _getRequireWildcardCache(r);
if (t && t.has(e)) return t.get(e);
var n = {
__proto__: null
},
a = Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
}
return n.default = e, t && t.set(e, n), n;
}
/**
* @since 2.0.0
* @category symbols
*/
const TakeTypeId = exports.TakeTypeId = internal.TakeTypeId;
/**
* Creates a `Take` with the specified chunk.
*
* @since 2.0.0
* @category constructors
*/
const chunk = exports.chunk = internal.chunk;
/**
* Creates a failing `Take` with the specified defect.
*
* @since 2.0.0
* @category constructors
*/
const die = exports.die = internal.die;
/**
* Creates a failing `Take` with the specified error message.
*
* @since 2.0.0
* @category constructors
*/
const dieMessage = exports.dieMessage = internal.dieMessage;
/**
* Transforms a `Take<A, E>` to an `Effect<A, E>`.
*
* @since 2.0.0
* @category destructors
*/
const done = exports.done = internal.done;
/**
* Represents the end-of-stream marker.
*
* @since 2.0.0
* @category constructors
*/
const end = exports.end = internal.end;
/**
* Creates a failing `Take` with the specified error.
*
* @since 2.0.0
* @category constructors
*/
const fail = exports.fail = internal.fail;
/**
* Creates a failing `Take` with the specified cause.
*
* @since 2.0.0
* @category constructors
*/
const failCause = exports.failCause = internal.failCause;
/**
* Creates an effect from `Effect<A, E, R>` that does not fail, but succeeds with
* the `Take<A, E>`. Error from stream when pulling is converted to
* `Take.failCause`. Creates a single value chunk.
*
* @since 2.0.0
* @category constructors
*/
const fromEffect = exports.fromEffect = internal.fromEffect;
/**
* Creates a `Take` from an `Exit`.
*
* @since 2.0.0
* @category constructors
*/
const fromExit = exports.fromExit = internal.fromExit;
/**
* Creates effect from `Effect<Chunk<A>, Option<E>, R>` that does not fail, but
* succeeds with the `Take<A, E>`. Errors from stream when pulling are converted
* to `Take.failCause`, and the end-of-stream is converted to `Take.end`.
*
* @since 2.0.0
* @category constructors
*/
const fromPull = exports.fromPull = internal.fromPull;
/**
* Checks if this `take` is done (`Take.end`).
*
* @since 2.0.0
* @category getters
*/
const isDone = exports.isDone = internal.isDone;
/**
* Checks if this `take` is a failure.
*
* @since 2.0.0
* @category getters
*/
const isFailure = exports.isFailure = internal.isFailure;
/**
* Checks if this `take` is a success.
*
* @since 2.0.0
* @category getters
*/
const isSuccess = exports.isSuccess = internal.isSuccess;
/**
* Constructs a `Take`.
*
* @since 2.0.0
* @category constructors
*/
const make = exports.make = internal.make;
/**
* Transforms `Take<A, E>` to `Take<B, A>` by applying function `f`.
*
* @since 2.0.0
* @category mapping
*/
const map = exports.map = internal.map;
/**
* Folds over the failure cause, success value and end-of-stream marker to
* yield a value.
*
* @since 2.0.0
* @category destructors
*/
const match = exports.match = internal.match;
/**
* Effectful version of `Take.fold`.
*
* Folds over the failure cause, success value and end-of-stream marker to
* yield an effect.
*
* @since 2.0.0
* @category destructors
*/
const matchEffect = exports.matchEffect = internal.matchEffect;
/**
* Creates a `Take` with a single value chunk.
*
* @since 2.0.0
* @category constructors
*/
const of = exports.of = internal.of;
/**
* Returns an effect that effectfully "peeks" at the success of this take.
*
* @since 2.0.0
* @category sequencing
*/
const tap = exports.tap = internal.tap;
//# sourceMappingURL=Take.js.map