@sapphire/result 2.8.0-next.6abc5522 → 2.8.0-next.f3515ea3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -41,7 +41,6 @@ var ResultError = _ResultError;
41
41
  // src/lib/Result.ts
42
42
  var ValueProperty = Symbol.for("@sapphire/result:Result.value");
43
43
  var SuccessProperty = Symbol.for("@sapphire/result:Result.success");
44
- var UnwrapSafeProperty = Symbol.for("@sapphire/result:Result.safeUnwrap");
45
44
  var _a, _b;
46
45
  var _Result = class _Result {
47
46
  constructor(value, success) {
@@ -468,7 +467,6 @@ var _Result = class _Result {
468
467
  * @seealso {@link unwrapOrElse}
469
468
  * @seealso {@link unwrapErr}
470
469
  * @seealso {@link unwrapRaw}
471
- * @seealso {@link unwrapSafe}
472
470
  *
473
471
  * @example
474
472
  * ```typescript
@@ -499,7 +497,6 @@ var _Result = class _Result {
499
497
  * @seealso {@link unwrapOr}
500
498
  * @seealso {@link unwrapOrElse}
501
499
  * @seealso {@link unwrapRaw}
502
- * @seealso {@link unwrapSafe}
503
500
  *
504
501
  * @example
505
502
  * ```typescript
@@ -531,7 +528,6 @@ var _Result = class _Result {
531
528
  * @seealso {@link unwrapOrElse}
532
529
  * @seealso {@link unwrapErr}
533
530
  * @seealso {@link unwrapRaw}
534
- * @seealso {@link unwrapSafe}
535
531
  *
536
532
  * @param defaultValue The default value.
537
533
  *
@@ -557,7 +553,6 @@ var _Result = class _Result {
557
553
  * @seealso {@link unwrapOr}
558
554
  * @seealso {@link unwrapErr}
559
555
  * @seealso {@link unwrapRaw}
560
- * @seealso {@link unwrapSafe}
561
556
  *
562
557
  * @param op The predicate.
563
558
  *
@@ -582,7 +577,6 @@ var _Result = class _Result {
582
577
  * @seealso {@link unwrapOr}
583
578
  * @seealso {@link unwrapOrElse}
584
579
  * @seealso {@link unwrapErr}
585
- * @seealso {@link unwrapSafe}
586
580
  *
587
581
  * @example
588
582
  * ```typescript
@@ -603,26 +597,6 @@ var _Result = class _Result {
603
597
  if (this.isErr()) throw this[ValueProperty];
604
598
  return this[ValueProperty];
605
599
  }
606
- /**
607
- * Returns the contained `Ok` value or yelds the contained `Err` value.
608
- * Emulates Rust's `?` operator in `safeTry`'s body. See also {@link Result.safeTry}.
609
- *
610
- * If used outside of a `safeTry`'s' body, throws the contained error.
611
- * @seealso {@link unwrap}
612
- * @seealso {@link unwrapOr}
613
- * @seealso {@link unwrapErr}
614
- * @seealso {@link unwrapRaw}
615
- * @seealso {@link unwrapSafe}
616
- *
617
- * @see {@link https://doc.rust-lang.org/std/result/enum.Result.html#method.unwrap_safe}
618
- */
619
- *unwrapSafe() {
620
- if (this.isOk()) {
621
- return this[ValueProperty];
622
- }
623
- yield this;
624
- throw new ResultError("Should not be used outside of a safe try generator", this[ValueProperty]);
625
- }
626
600
  /**
627
601
  * Returns `result` if the result is `Ok`, otherwise returns the `Err` value of itself.
628
602
  * @param result The result to check.
@@ -897,16 +871,6 @@ var _Result = class _Result {
897
871
  get [Symbol.toStringTag]() {
898
872
  return this.match({ ok: /* @__PURE__ */ __name(() => "Ok", "ok"), err: /* @__PURE__ */ __name(() => "Err", "err") });
899
873
  }
900
- /**
901
- * This function, in combination with `[$]`, is intended to emulate
902
- * Rust's ? operator.
903
- *
904
- * @see {@link Result.safeTry}
905
- * @see {@link https://doc.rust-lang.org/std/result/enum.Result.html#method.safeTry}
906
- */
907
- get [UnwrapSafeProperty]() {
908
- return this.unwrapSafe();
909
- }
910
874
  // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
911
875
  static ok(value) {
912
876
  return new _Result(value, true);
@@ -1026,13 +990,6 @@ var _Result = class _Result {
1026
990
  }
1027
991
  return err(errors);
1028
992
  }
1029
- static safeTry(body) {
1030
- const n = body({ $: UnwrapSafeProperty, $async: unwrapSafeAsync }).next();
1031
- if (n instanceof Promise) {
1032
- return n.then((r) => r.value);
1033
- }
1034
- return n.value;
1035
- }
1036
993
  };
1037
994
  __name(_Result, "Result");
1038
995
  var Result = _Result;
@@ -1041,11 +998,6 @@ function resolve(value) {
1041
998
  return Result.isResult(value) ? value : ok(value);
1042
999
  }
1043
1000
  __name(resolve, "resolve");
1044
- async function* unwrapSafeAsync(result) {
1045
- const _result = await result;
1046
- return yield* _result.unwrapSafe();
1047
- }
1048
- __name(unwrapSafeAsync, "unwrapSafeAsync");
1049
1001
 
1050
1002
  // src/lib/Option.ts
1051
1003
  var ValueProperty2 = Symbol.for("@sapphire/result:Option.value");