UNPKG

option-t

Version:

A toolkit of Nullable/Option/Result type implementation in ECMAScript. Their APIs are inspired by Rust's `Option<T>` and `Result<T, E>`.

55 lines (54 loc) 2.87 kB
/** * Please migrate your codes to: * 1. `ResultOperator` or `ResultFactory` of `option-t/plain_result`. * 2. Import `option-t/plain_result/***` directly. */ export { createErr, createOk, expectErr, expectOk, isErr, isOk, unwrapErr, unwrapOk, } from '../core/result.js'; export { andThenForResult } from '../operators/and_then.js'; export { andThenAsyncForResult } from '../operators/and_then_async.js'; export { flattenForResult } from '../operators/flatten.js'; export { fromPromiseSettledResultToResult } from '../operators/from_promise_settled_result.js'; export { inspectBothForResult, inspectErrForResult, inspectOkForResult, } from '../operators/inspect.js'; export { isErrAndForResult, isErrAndWithEnsureTypeForResult } from '../operators/is_err_and.js'; export { isOkAndForResult, isOkAndWithEnsureTypeForResult } from '../operators/is_ok_and.js'; export { mapForResult } from '../operators/map.js'; export { mapAsyncForResult } from '../operators/map_async.js'; export { mapErrForResult } from '../operators/map_err.js'; export { mapErrAsyncForResult } from '../operators/map_err_async.js'; export { mapOrForResult } from '../operators/map_or.js'; export { mapOrAsyncForResult } from '../operators/map_or_async.js'; export { mapOrElseForResult } from '../operators/map_or_else.js'; export { mapOrElseAsyncForResult } from '../operators/map_or_else_async.js'; export { orElseForResult } from '../operators/or_else.js'; export { orElseAsyncForResult } from '../operators/or_else_async.js'; export { toNullableFromErr, toNullableFromOk } from '../operators/to_nullable.js'; export { toUndefinableFromErr, toUndefinableFromOk } from '../operators/to_undefinable.js'; export { transposeResultToNullable, transposeResultToUndefinable } from '../operators/transpose.js'; export { tryCatchIntoResult, tryCatchIntoResultWithEnsureError } from '../operators/try_catch.js'; export { tryCatchIntoResultAsync, tryCatchIntoResultWithEnsureErrorAsync, } from '../operators/try_catch_async.js'; export { unwrapOrForResult } from '../operators/unwrap_or.js'; export { unwrapOrElseForResult } from '../operators/unwrap_or_else.js'; export { unwrapOrElseAsyncForResult } from '../operators/unwrap_or_else_async.js'; export { unwrapOrThrowForResult } from '../operators/unwrap_or_throw.js'; // XXX: // We don't expose these itens that is unsafe operation. // // - as_mut // - drop // // XXX: // _equals, we don't expose it by this due to that is provided for exception case // // XXX: // To keep a simple API set, // we don't expose APIs from here that takes multiple values to compose a data flow pipeline. // We may reconsider it if pipeline operator syntax proposal is advanced to the standard. // But please import them directly from their path at this moment. // // - and // - or // - filter // - xor // - zip // - zipWith // - zipWithAsync