From 03ec56ab4f2cf483e9754f74d324344cbbe0fe36 Mon Sep 17 00:00:00 2001 From: crimx Date: Wed, 13 Nov 2024 02:21:50 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20wopjs/ts?= =?UTF-8?q?ur@f412bdb2c9c7b62d49144e42c0bb4a00ab29c48c=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- classes/index.Option.html | 68 ++++++++++++++--------------- classes/index.Result.html | 68 ++++++++++++++--------------- functions/index.Err-1.html | 2 +- functions/index.Ok-1.html | 2 +- functions/index.Some-1.html | 2 +- functions/index.filterMap.html | 2 +- functions/index.first.html | 2 +- functions/index.firstIndex.html | 2 +- functions/index.firstMap.html | 2 +- functions/index.last.html | 2 +- functions/index.lastIndex.html | 2 +- functions/index.lastMap.html | 2 +- functions/index.mapWhile.html | 2 +- functions/index.reduceWhile.html | 2 +- interfaces/index.ResultMatcher.html | 4 +- interfaces/patches_array.Array.html | 20 ++++----- modules/index.html | 2 +- modules/patches_array.html | 2 +- types/index.Err.html | 2 +- types/index.None.html | 2 +- types/index.Ok.html | 2 +- types/index.Some.html | 2 +- types/index.UnwrapErr.html | 2 +- types/index.UnwrapOk.html | 2 +- types/index.UnwrapOption.html | 2 +- variables/index.None-1.html | 2 +- 26 files changed, 102 insertions(+), 102 deletions(-) diff --git a/classes/index.Option.html b/classes/index.Option.html index 2648283..42e9f1e 100644 --- a/classes/index.Option.html +++ b/classes/index.Option.html @@ -1,6 +1,6 @@ Option | @wopjs/tsur - v0.1.3

Class Option<T>

The Option type is an immutable representation of an optional value: every Option is either Some and contains a value, or None and does not.

-

Type Parameters

  • T = any

Properties

Type Parameters

  • T = any

Properties

Methods

[iterator] and andThen @@ -31,99 +31,99 @@ Some unwrapOr

Properties

None: None = ...

The None value.

-

Methods

  • Returns an iterator over the possibly contained value.

    +

Methods

  • Returns an iterator over the possibly contained value.

    The iterator yields one value if the result is Some, otherwise none.

    -

    Returns Generator<T, void, unknown>

  • Type Parameters

    • B

    Parameters

    Returns Option<B>

    None if the Option is None, otherwise returns optionB.

    Arguments passed to and are eagerly evaluated; if you are passing the result of a function call, it is recommended to use andThen, which is lazily evaluated.

    -
  • Type Parameters

    • B

    Parameters

  • Type Parameters

    • B

    Parameters

    • getOptionB: ((value: T) => Option<B>)

      A function that returns an Option

    • OptionalthisArg: any

      If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

    Returns Option<B>

    None if the Option is None, otherwise calls getOptionB with the wrapped value and returns the result.

    -
  • Returns None if the Option is None, otherwise calls predicate with the wrapped value and returns:

    +
  • Returns None if the Option is None, otherwise calls predicate with the wrapped value and returns:

    • Some(t) if predicate returns true (where t is the wrapped value with inferred new type), and
    • None if predicate returns false.

    Type Parameters

    • U

    Parameters

    • predicate: ((value: T) => value is U)

      A type predicate function that defines type guard by returning true or false.

        • (value): value is U
        • Parameters

          • value: T

          Returns value is U

    • OptionalthisArg: any

      If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

      -

    Returns Option<U>

  • Returns None if the Option is None, otherwise calls predicate with the wrapped value and returns:

    +

Returns Option<U>

  • Returns None if the Option is None, otherwise calls predicate with the wrapped value and returns:

    • Some(t) if predicate returns true (where t is the wrapped value), and
    • None if predicate returns false.

    Parameters

    • predicate: ((value: T) => boolean)

      A function that returns true or false.

        • (value): boolean
        • Parameters

          • value: T

          Returns boolean

    • OptionalthisArg: any

      If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

      -

    Returns Option<T>

    • Returns boolean

      true if the Option is a None.

      -
    • Whether this value is the same as the other Option.

      +

    Returns Option<T>

    • Returns boolean

      true if the Option is a None.

      +
    • Whether this value is the same as the other Option.

      Parameters

      • other: unknown

        Another Option or any value

      Returns boolean

      true if the other is an Option and the value are the same as this value via Object.is.

      -
    • Returns boolean

      true if the Option is a Some.

      -
    • Parameters

      • predicate: ((value: T) => boolean)

        A function that returns true if the value satisfies the predicate, otherwise false

        +
    • Returns boolean

      true if the Option is a Some.

      +
    • Parameters

      • predicate: ((value: T) => boolean)

        A function that returns true if the value satisfies the predicate, otherwise false

          • (value): boolean
          • Parameters

            • value: T

            Returns boolean

      • OptionalthisArg: any

        If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

      Returns boolean

      true if the Option is a Some and and the value inside of it matches a predicate.

      -
    • Maps an Option<T> to Option<U> by applying a function to a contained value (if Some) or returns None (if None).

      +
    • Maps an Option<T> to Option<U> by applying a function to a contained value (if Some) or returns None (if None).

      Type Parameters

      • U

      Parameters

      • fn: ((value: T) => U)

        A function that maps a value to another value

          • (value): U
          • Parameters

            • value: T

            Returns U

      • OptionalthisArg: any

        If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

      Returns Option<U>

      None if the Option is None, otherwise returns Some(fn(value)).

      -
    • Extract the value from an Option in a way that handles both the Some and None cases.

      +
    • Extract the value from an Option in a way that handles both the Some and None cases.

      Type Parameters

      • U

      Parameters

      • Some: ((value: T) => U)

        A function that returns a value if the Option is a Some.

          • (value): U
          • Parameters

            • value: T

            Returns U

      • None: (() => U)

        A function that returns a value if the Option is a None.

          • (): U
          • Returns U

      Returns U

      The value returned by the provided function.

      -
    • Transforms the Option<T> into a Result<T, E>, mapping Some(v) to Ok(v) and None to Err(err).

      +
    • Transforms the Option<T> into a Result<T, E>, mapping Some(v) to Ok(v) and None to Err(err).

      Arguments passed to okOr are eagerly evaluated; if you are passing the result of a function call, it is recommended to use okOrElse, which is lazily evaluated.

      Type Parameters

      • E

      Parameters

      • error: E

        The error value for Err if the Option is None.

        -

      Returns Result<T, E>

    • Transforms the Option<T> into a Result<T, E>, mapping Some(v) to Ok(v) and None to Err(err()).

      +

    Returns Result<T, E>

    Returns Option<Exclude<T, Falsy>>

  • Wrap a value in an Option if the value satisfies the predicate.

    Type Parameters

    Parameters

    • source: TSource

      Source value

    • predicate: ((source: TSource) => source is T)

      A function that returns true if the value satisfies the predicate, otherwise false

        • (source): source is T
        • Parameters

          Returns source is T

    • OptionalthisArg: any

      If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

      -

    Returns Option<T>

  • Wrap a value in an Option if the value satisfies the predicate.

    +
  • Returns Option<T>

  • Wrap a value in an Option if the value satisfies the predicate.

    Type Parameters

    Parameters

    • source: TSource

      Source value

    • predicate: ((source: TSource) => boolean)

      A function that returns true if the value satisfies the predicate, otherwise false

      -
        • (source): boolean
        • Parameters

          Returns boolean

    • OptionalthisArg: any

    Returns Option<T>

  • +
    diff --git a/classes/index.Result.html b/classes/index.Result.html index f8545a0..535b6e7 100644 --- a/classes/index.Result.html +++ b/classes/index.Result.html @@ -1,5 +1,5 @@ Result | @wopjs/tsur - v0.1.3

    Class Result<T, E>

    The Result type is an immutable representation of either success (Ok) or failure (Err).

    -

    Type Parameters

    • T = any
    • E = any

    Methods

    Type Parameters

    • T = any
    • E = any

    Methods

    [iterator] and andThen err @@ -32,87 +32,87 @@ tryAsync

    Methods

    • Returns an iterator over the possibly contained value.

      The iterator yields one value if the result is Ok, otherwise none.

      -

      Returns Generator<T, void, unknown>

    • Type Parameters

      • BT
      • BE = any

      Parameters

      • getResultB: ((value: T) => Result<BT, BE>)

        A function that returns a Result

        +

        Returns Generator<T, void, unknown>

    • Type Parameters

      • BT
      • BE = any

      Parameters

      • getResultB: ((value: T) => Result<BT, BE>)

        A function that returns a Result

      • OptionalthisArg: any

        If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

      Returns Result<BT, E | BE>

      Err if the Result is Err, otherwise calls getOptionB with the wrapped value and returns the result.

      -
    • Returns boolean

      true if the Result is an Err.

      -
    • Parameters

      • predicate: ((error: E) => boolean)
          • (error): boolean
          • Parameters

            • error: E

            Returns boolean

      • OptionalthisArg: any

        If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

        +
    • Returns boolean

      true if the Result is an Err.

      +
    • Parameters

      • predicate: ((error: E) => boolean)
          • (error): boolean
          • Parameters

            • error: E

            Returns boolean

      • OptionalthisArg: any

        If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

      Returns boolean

      true if the Result is an Err and and the error inside of it matches a predicate.

      -
    • Returns boolean

      true if the Result is an Ok.

      -
    • Parameters

      • predicate: ((value: T) => boolean)
          • (value): boolean
          • Parameters

            • value: T

            Returns boolean

      • OptionalthisArg: any

        If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

        +
    • Returns boolean

      true if the Result is an Ok.

      +
    • Parameters

      • predicate: ((value: T) => boolean)
          • (value): boolean
          • Parameters

            • value: T

            Returns boolean

      • OptionalthisArg: any

        If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

      Returns boolean

      true if the Result is an Ok and and the value inside of it matches a predicate.

      -
    • Whether this Ok value or Err error is the same as the other Result.

      +
    • Whether this Ok value or Err error is the same as the other Result.

      Parameters

      • other: unknown

        Another Result or any value

      Returns boolean

      true if the other is an Result and the Ok value or Err error is the same as this via Object.is.

      -
    • Maps an Result<T, E> to Result<U, E> by applying a function to a contained Ok value, leaving an Err value untouched.

      +
    • Maps an Result<T, E> to Result<U, E> by applying a function to a contained Ok value, leaving an Err value untouched.

      Type Parameters

      • U

      Parameters

      • fn: ((value: T) => U)

        A function that maps a value to another value

          • (value): U
          • Parameters

            • value: T

            Returns U

      • OptionalthisArg: any

        If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

      Returns Result<U, E>

      Err if the Result is Err, otherwise returns Ok(fn(value)).

      -
    • Maps a Result<T, E> to Result<T, F> by applying a function to a contained Err value, leaving an Ok value untouched.

      +
    • Maps a Result<T, E> to Result<T, F> by applying a function to a contained Err value, leaving an Ok value untouched.

      This function can be used to pass through a successful result while handling an error.

      Type Parameters

      • U

      Parameters

      • fn: ((error: E) => U)

        A function that maps a error to another error

          • (error): U
          • Parameters

            • error: E

            Returns U

      • OptionalthisArg: any

        If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

      Returns Result<T, U>

      Ok if the Result is Ok, otherwise returns Err(fn(error)).

      -
    • Extract the value from an Result in a way that handles both the Ok and Err cases.

      +
    • Extract the value from an Result in a way that handles both the Ok and Err cases.

      Type Parameters

      • U

      Parameters

      • Ok: ((value: T) => U)

        A function that returns a value if the Result is a Ok.

          • (value): U
          • Parameters

            • value: T

            Returns U

      • Err: ((error: E) => U)

        A function that returns a value if the Result is a Err.

          • (error): U
          • Parameters

            • error: E

            Returns U

      Returns U

      The value returned by the provided function.

      -
    • Type Parameters

      • BT
      • BE = any

      Parameters

      Returns Result<T | BT, E | BE>

      the Result if it is Ok, otherwise returns resultB.

      Arguments passed to or are eagerly evaluated; if you are passing the result of a function call, it is recommended to use orElse, which is lazily evaluated.

      -
    • Type Parameters

      • BT
      • BE = any

      Parameters

      • getResultB: (() => Result<BT, BE>)

        A function that returns an Result

      • OptionalthisArg: any

        If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

      Returns Result<T | BT, E | BE>

      the Result if it contains a value, otherwise calls getResultB and returns the result.

      -
    • Parameters

      • message: string = "called `Result.unwrap()` on an `Err`"

        Optional Error message

      Returns T

      the contained Ok value.

      if the value is an Err.

      -
    • Parameters

      • message: string = "called `Result.unwrapErr()` on an `Ok` value"

        Optional Error message

        +
    • Parameters

      • message: string = "called `Result.unwrapErr()` on an `Ok` value"

        Optional Error message

      Returns E

      the contained Err error.

      if the error is an Ok.

      -
    • Returns undefined | E

      the contained Err error or undefined otherwise.

      +
    • Returns undefined | E

      the contained Err error or undefined otherwise.

      Arguments passed to unwrapErrOr are eagerly evaluated; if you are passing the result of a function call, it is recommended to use unwrapErrOrElse, which is lazily evaluated.

      -
    • Type Parameters

      • U

      Parameters

      • defaultError: U

        default error

        +
      • Type Parameters

        • U

        Parameters

        • defaultError: U

          default error

        Returns E | U

        the contained Err error or a provided default.

        Arguments passed to unwrapErrOr are eagerly evaluated; if you are passing the result of a function call, it is recommended to use unwrapErrOrElse, which is lazily evaluated.

        -
    • Type Parameters

      • U

      Parameters

      • fn: (() => U)

        A function that computes a default value.

        +
    • Type Parameters

      • U

      Parameters

      • fn: (() => U)

        A function that computes a default value.

          • (): U
          • Returns U

      • OptionalthisArg: any

        If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

      Returns E | U

      the contained Err error or computes it from a closure.

      -
    • Returns undefined | T

      the contained Ok value or undefined otherwise.

      -
    • Type Parameters

      • U

      Parameters

    • Returns undefined | T

      the contained Ok value or undefined otherwise.

      +
    • Type Parameters

      • U

      Parameters

      • defaultValue: U

        default value

      Returns T | U

      the contained Ok value or a provided default.

      Arguments passed to unwrapOr are eagerly evaluated; if you are passing the result of a function call, it is recommended to use unwrapOrElse, which is lazily evaluated.

      -
    • Type Parameters

      • U

      Parameters

      • fn: (() => U)

        A function that computes a default value.

        +
    • Type Parameters

      • U

      Parameters

      • fn: (() => U)

        A function that computes a default value.

          • (): U
          • Returns U

      • OptionalthisArg: any

        If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

      Returns T | U

      the contained Ok value or computes it from a closure.

      -
    • Type Parameters

      • E
      • T = any

      Parameters

      • error: E

        An error of type E

      Returns Result<T, E>

      Wrap an error into an Result.

      -
    • Err if the value is an Error.

      -

      Type Parameters

      • T = any
      • E extends Error = Error

      Parameters

      • source: T | E

      Returns Result<T, E>

    • OK if the value satisfies the predicate, otherwise Err

      +
    • Err if the value is an Error.

      +

      Type Parameters

      • T = any
      • E extends Error = Error

      Parameters

      • source: T | E

      Returns Result<T, E>

    • OK if the value satisfies the predicate, otherwise Err

      Type Parameters

      • T = any
      • E = any

      Parameters

      • source: T | E

        Source value

      • predicate: ((source: T | E) => source is T)

        A function that returns true if the value satisfies the predicate, otherwise false

          • (source): source is T
          • Parameters

            • source: T | E

            Returns source is T

      • OptionalthisArg: any

        If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

        -

      Returns Result<T, E>

    • OK if the value satisfies the predicate, otherwise Err

      +

    Returns Result<T, E>

  • OK if the value satisfies the predicate, otherwise Err

    Type Parameters

    • T = any
    • E = any

    Parameters

    • source: T | E

      Source value

    • predicate: ((source: T | E) => boolean)

      A function that returns true if the value satisfies the predicate, otherwise false

        • (source): boolean
        • Parameters

          • source: T | E

          Returns boolean

    • OptionalthisArg: any

      If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

      -

    Returns Result<T, E>

  • +
    diff --git a/functions/index.Err-1.html b/functions/index.Err-1.html index fd700b4..dfbc10f 100644 --- a/functions/index.Err-1.html +++ b/functions/index.Err-1.html @@ -2,4 +2,4 @@

    Wrap an error into an Result.

    +
    diff --git a/functions/index.Ok-1.html b/functions/index.Ok-1.html index 34c9dcf..620c2a1 100644 --- a/functions/index.Ok-1.html +++ b/functions/index.Ok-1.html @@ -2,4 +2,4 @@

    Wrap a value into an Result.

    +
    diff --git a/functions/index.Some-1.html b/functions/index.Some-1.html index 2ba4e20..083c52e 100644 --- a/functions/index.Some-1.html +++ b/functions/index.Some-1.html @@ -2,4 +2,4 @@

    Wrap a value into an Option.

    +
    diff --git a/functions/index.filterMap.html b/functions/index.filterMap.html index 72ec397..1453247 100644 --- a/functions/index.filterMap.html +++ b/functions/index.filterMap.html @@ -4,4 +4,4 @@
  • fn: ((value: T, index: number, array: T[]) => Option<U>)

    A function that produces an Option.

  • OptionalthisArg: any

    If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

  • Returns U[]

    An array of filtered and mapped values.

    -
    +
    diff --git a/functions/index.first.html b/functions/index.first.html index b986de2..c75f638 100644 --- a/functions/index.first.html +++ b/functions/index.first.html @@ -3,4 +3,4 @@
  • predicate: ((value: T, index: number, array: T[]) => boolean) = truePredicate

    A predicate function.

  • OptionalthisArg: any

    If provided, it will be used as the this value for each invocation of predicate. If it is not provided, the first element is returned.

  • Returns Option<T>

    The first item that matches the predicate, or None if no item matches.

    -
    +
    diff --git a/functions/index.firstIndex.html b/functions/index.firstIndex.html index 143676b..decd375 100644 --- a/functions/index.firstIndex.html +++ b/functions/index.firstIndex.html @@ -3,4 +3,4 @@
  • predicate: ((value: T, index: number, array: T[]) => boolean)

    A predicate function.

  • OptionalthisArg: any

    If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

  • Returns Option<number>

    The index of the first item that matches the predicate, or None if no item matches.

    -
    +
    diff --git a/functions/index.firstMap.html b/functions/index.firstMap.html index 0e9ccd9..eef0de3 100644 --- a/functions/index.firstMap.html +++ b/functions/index.firstMap.html @@ -4,4 +4,4 @@
  • fn: ((value: T, index: number, array: T[]) => Option<U>)

    A function that produces an Option.

  • OptionalthisArg: any

    If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

  • Returns Option<U>

    The first non-none result.

    -
    +
    diff --git a/functions/index.last.html b/functions/index.last.html index d261f99..143d431 100644 --- a/functions/index.last.html +++ b/functions/index.last.html @@ -3,4 +3,4 @@
  • predicate: ((value: T, index: number, array: T[]) => boolean) = truePredicate

    A predicate function.

  • OptionalthisArg: any

    If provided, it will be used as the this value for each invocation of predicate. If it is not provided, the last element is returned.

  • Returns Option<T>

    The last item that matches the predicate, or None if no item matches.

    -
    +
    diff --git a/functions/index.lastIndex.html b/functions/index.lastIndex.html index 6640ebd..dc933af 100644 --- a/functions/index.lastIndex.html +++ b/functions/index.lastIndex.html @@ -3,4 +3,4 @@
  • predicate: ((value: T, index: number, array: T[]) => boolean)

    lastIndex calls predicate once for each element of the array, in backward order, until it finds one where predicate returns true.

  • OptionalthisArg: any

    If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

  • Returns Option<number>

    The index of the last item that matches the predicate, or None if no item matches.

    -
    +
    diff --git a/functions/index.lastMap.html b/functions/index.lastMap.html index 5852055..483e78e 100644 --- a/functions/index.lastMap.html +++ b/functions/index.lastMap.html @@ -3,4 +3,4 @@
  • fn: ((value: T, index: number, array: T[]) => Option<U>)

    A function that produces an Option.

  • OptionalthisArg: any

    If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

  • Returns Option<U>

    The last non-none result.

    -
    +
    diff --git a/functions/index.mapWhile.html b/functions/index.mapWhile.html index f77c998..805699d 100644 --- a/functions/index.mapWhile.html +++ b/functions/index.mapWhile.html @@ -3,4 +3,4 @@
  • fn: ((value: T, index: number, array: T[]) => Option<U>)

    A function that produces an Option.

  • OptionalthisArg: any

    If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

  • Returns U[]

    An array of mapped values.

    -
    +
    diff --git a/functions/index.reduceWhile.html b/functions/index.reduceWhile.html index 99df242..5ea84c1 100644 --- a/functions/index.reduceWhile.html +++ b/functions/index.reduceWhile.html @@ -4,4 +4,4 @@
  • initialValue: U

    The initial value.

  • OptionalthisArg: any

    If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

  • Returns U

    The reduced value.

    -
    +
    diff --git a/interfaces/index.ResultMatcher.html b/interfaces/index.ResultMatcher.html index 621356e..2e82d01 100644 --- a/interfaces/index.ResultMatcher.html +++ b/interfaces/index.ResultMatcher.html @@ -1,3 +1,3 @@ -ResultMatcher | @wopjs/tsur - v0.1.3

    Interface ResultMatcher<T, E, U>

    interface ResultMatcher<T, E, U> {
        Err: ((error: E) => U);
        Ok: ((value: T) => U);
    }

    Type Parameters

    • T = any
    • E = any
    • U = any

    Properties

    Err +ResultMatcher | @wopjs/tsur - v0.1.3

    Interface ResultMatcher<T, E, U>

    interface ResultMatcher<T, E, U> {
        Err: ((error: E) => U);
        Ok: ((value: T) => U);
    }

    Type Parameters

    • T = any
    • E = any
    • U = any

    Properties

    Properties

    Err: ((error: E) => U)
    Ok: ((value: T) => U)
    +

    Properties

    Err: ((error: E) => U)
    Ok: ((value: T) => U)
    diff --git a/interfaces/patches_array.Array.html b/interfaces/patches_array.Array.html index 759e367..851d8c2 100644 --- a/interfaces/patches_array.Array.html +++ b/interfaces/patches_array.Array.html @@ -1,4 +1,4 @@ -Array | @wopjs/tsur - v0.1.3
    interface Array<T> {
        $filterMap<U>(fn: ((value: T, index: number, array: T[]) => Option<U>), thisArg?: any): U[];
        $first(predicate?: ((value: T, index: number, array: T[]) => boolean), thisArg?: any): Option<T>;
        $firstIndex(predicate: ((value: T, index: number, array: T[]) => boolean), thisArg?: any): Option<number>;
        $firstMap<U>(fn: ((value: T, index: number, array: T[]) => Option<U>), thisArg?: any): Option<U>;
        $last(predicate?: ((value: T, index: number, array: T[]) => boolean), thisArg?: any): Option<T>;
        $lastIndex(predicate: ((value: T, index: number, array: T[]) => boolean), thisArg?: any): Option<number>;
        $lastMap<U>(fn: ((value: T, index: number, array: T[]) => Option<U>), thisArg?: any): Option<U>;
        $mapWhile<U>(fn: ((value: T, index: number, array: T[]) => Option<U>), thisArg?: any): U[];
        $reduceWhile<U>(fn: ((previousValue: U, currentValue: T, currentIndex: number, array: T[]) => Option<U>), initialValue: U, thisArg?: any): U;
    }

    Type Parameters

    • T

    Methods

    $filterMap +Array | @wopjs/tsur - v0.1.3
    interface Array<T> {
        $filterMap<U>(fn: ((value: T, index: number, array: T[]) => Option<U>), thisArg?: any): U[];
        $first(predicate?: ((value: T, index: number, array: T[]) => boolean), thisArg?: any): Option<T>;
        $firstIndex(predicate: ((value: T, index: number, array: T[]) => boolean), thisArg?: any): Option<number>;
        $firstMap<U>(fn: ((value: T, index: number, array: T[]) => Option<U>), thisArg?: any): Option<U>;
        $last(predicate?: ((value: T, index: number, array: T[]) => boolean), thisArg?: any): Option<T>;
        $lastIndex(predicate: ((value: T, index: number, array: T[]) => boolean), thisArg?: any): Option<number>;
        $lastMap<U>(fn: ((value: T, index: number, array: T[]) => Option<U>), thisArg?: any): Option<U>;
        $mapWhile<U>(fn: ((value: T, index: number, array: T[]) => Option<U>), thisArg?: any): U[];
        $reduceWhile<U>(fn: ((previousValue: U, currentValue: T, currentIndex: number, array: T[]) => Option<U>), initialValue: U, thisArg?: any): U;
    }

    Type Parameters

    • T

    Methods

    $filterMap $first $firstIndex $firstMap @@ -13,46 +13,46 @@

    Type Parameters

    • U

    Parameters

    • fn: ((value: T, index: number, array: T[]) => Option<U>)

      A function that produces an Option.

        • (value, index, array): Option<U>
        • Parameters

          • value: T
          • index: number
          • array: T[]

          Returns Option<U>

    • OptionalthisArg: any

      If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

    Returns U[]

    An array of filtered and mapped values.

    -
    • From tsur.

      first finds the first item that matches a predicate. Returns the first item of array if no predicate is provided.

      Parameters

      • Optionalpredicate: ((value: T, index: number, array: T[]) => boolean)

        A predicate function.

          • (value, index, array): boolean
          • Parameters

            • value: T
            • index: number
            • array: T[]

            Returns boolean

      • OptionalthisArg: any

        If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

      Returns Option<T>

      The first item that matches the predicate, or None if no item matches.

      -
    • From tsur.

      Returns the index of the first element in the array that satisfies the provided testing function. Otherwise None is returned.

      Parameters

      • predicate: ((value: T, index: number, array: T[]) => boolean)

        A predicate function.

          • (value, index, array): boolean
          • Parameters

            • value: T
            • index: number
            • array: T[]

            Returns boolean

      • OptionalthisArg: any

        If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

      Returns Option<number>

      The index of the first item that matches the predicate, or None if no item matches.

      -
    • From tsur.

      Applies function to the elements of iterator and returns the first non-none result.

      firstMap(fn) is the lighter version of filterMap(fn).first().

      Type Parameters

      • U

      Parameters

      • fn: ((value: T, index: number, array: T[]) => Option<U>)

        A function that produces an Option.

          • (value, index, array): Option<U>
          • Parameters

            • value: T
            • index: number
            • array: T[]

            Returns Option<U>

      • OptionalthisArg: any

        If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

      Returns Option<U>

      The first non-none result.

      -
    • From tsur.

      last finds the last item that matches a predicate. Returns the last item of array if no predicate is provided.

      Parameters

      • Optionalpredicate: ((value: T, index: number, array: T[]) => boolean)

        A predicate function.

          • (value, index, array): boolean
          • Parameters

            • value: T
            • index: number
            • array: T[]

            Returns boolean

      • OptionalthisArg: any

        If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

      Returns Option<T>

      The last item that matches the predicate, or None if no item matches.

      -
    • From tsur.

      Returns the index of the last element in the array where predicate is true, and None otherwise.

      Parameters

      • predicate: ((value: T, index: number, array: T[]) => boolean)

        lastIndex calls predicate once for each element of the array, in backward order, until it finds one where predicate returns true.

          • (value, index, array): boolean
          • Parameters

            • value: T
            • index: number
            • array: T[]

            Returns boolean

      • OptionalthisArg: any

        If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

      Returns Option<number>

      The index of the last item that matches the predicate, or None if no item matches.

      -
    • From tsur.

      lastMap(fn) is the lighter version of filterMap(fn).last().

      Type Parameters

      • U

      Parameters

      • fn: ((value: T, index: number, array: T[]) => Option<U>)

        A function that produces an Option.

          • (value, index, array): Option<U>
          • Parameters

            • value: T
            • index: number
            • array: T[]

            Returns Option<U>

      • OptionalthisArg: any

        If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

      Returns Option<U>

      The last non-none result.

      -
    • From tsur.

      mapWhile maps an iterable until the first None is encountered.

      Type Parameters

      • U

      Parameters

      • fn: ((value: T, index: number, array: T[]) => Option<U>)

        A function that produces an Option.

          • (value, index, array): Option<U>
          • Parameters

            • value: T
            • index: number
            • array: T[]

            Returns Option<U>

      • OptionalthisArg: any

        If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

      Returns U[]

      An array of mapped values.

      -
    • From tsur.

      reduceWhile reduces an iterable until the first None is encountered.

      Type Parameters

      • U = T

      Parameters

      • fn: ((previousValue: U, currentValue: T, currentIndex: number, array: T[]) => Option<U>)

        A function that produces an Option.

          • (previousValue, currentValue, currentIndex, array): Option<U>
          • Parameters

            • previousValue: U
            • currentValue: T
            • currentIndex: number
            • array: T[]

            Returns Option<U>

      • initialValue: U

        The initial value.

      • OptionalthisArg: any

        If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

      Returns U

      The reduced value.

      -
    +
    diff --git a/modules/index.html b/modules/index.html index f5d0b4a..346397a 100644 --- a/modules/index.html +++ b/modules/index.html @@ -1,4 +1,4 @@ -index | @wopjs/tsur - v0.1.3

    Module index

    Index

    Classes

    Option +index | @wopjs/tsur - v0.1.3

    Module index

    Index

    Classes

    Interfaces

    Type Aliases

    Err diff --git a/modules/patches_array.html b/modules/patches_array.html index 1e190d3..d399a16 100644 --- a/modules/patches_array.html +++ b/modules/patches_array.html @@ -1,2 +1,2 @@ -patches/array | @wopjs/tsur - v0.1.3

    Module patches/array

    Index

    Interfaces

    Array +patches/array | @wopjs/tsur - v0.1.3

    Module patches/array

    Index

    Interfaces

    diff --git a/types/index.Err.html b/types/index.Err.html index 87cff26..e3eaa4f 100644 --- a/types/index.Err.html +++ b/types/index.Err.html @@ -1 +1 @@ -Err | @wopjs/tsur - v0.1.3

    Type Alias Err<E>

    Err<E>: Result<any, E>

    Type Parameters

    • E
    +Err | @wopjs/tsur - v0.1.3

    Type Alias Err<E>

    Err<E>: Result<any, E>

    Type Parameters

    • E
    diff --git a/types/index.None.html b/types/index.None.html index 1fbd8d7..f2c7091 100644 --- a/types/index.None.html +++ b/types/index.None.html @@ -1 +1 @@ -None | @wopjs/tsur - v0.1.3

    Type Alias None

    None: Option<any>
    +None | @wopjs/tsur - v0.1.3

    Type Alias None

    None: Option<any>
    diff --git a/types/index.Ok.html b/types/index.Ok.html index 8872515..cc2b2a5 100644 --- a/types/index.Ok.html +++ b/types/index.Ok.html @@ -1 +1 @@ -Ok | @wopjs/tsur - v0.1.3

    Type Alias Ok<T>

    Ok<T>: Result<T, any>

    Type Parameters

    • T
    +Ok | @wopjs/tsur - v0.1.3

    Type Alias Ok<T>

    Ok<T>: Result<T, any>

    Type Parameters

    • T
    diff --git a/types/index.Some.html b/types/index.Some.html index a101012..697d535 100644 --- a/types/index.Some.html +++ b/types/index.Some.html @@ -1 +1 @@ -Some | @wopjs/tsur - v0.1.3

    Type Alias Some<T>

    Some<T>: Option<T>

    Type Parameters

    • T
    +Some | @wopjs/tsur - v0.1.3

    Type Alias Some<T>

    Some<T>: Option<T>

    Type Parameters

    • T
    diff --git a/types/index.UnwrapErr.html b/types/index.UnwrapErr.html index 362c577..cc29553 100644 --- a/types/index.UnwrapErr.html +++ b/types/index.UnwrapErr.html @@ -1 +1 @@ -UnwrapErr | @wopjs/tsur - v0.1.3

    Type Alias UnwrapErr<E, Default>

    UnwrapErr<E, Default>: E extends Result<infer _S, infer U>
        ? U
        : Default

    Type Parameters

    • E
    • Default = E
    +UnwrapErr | @wopjs/tsur - v0.1.3

    Type Alias UnwrapErr<E, Default>

    UnwrapErr<E, Default>: E extends Result<infer _S, infer U>
        ? U
        : Default

    Type Parameters

    • E
    • Default = E
    diff --git a/types/index.UnwrapOk.html b/types/index.UnwrapOk.html index 2a98246..9a9ba07 100644 --- a/types/index.UnwrapOk.html +++ b/types/index.UnwrapOk.html @@ -1 +1 @@ -UnwrapOk | @wopjs/tsur - v0.1.3

    Type Alias UnwrapOk<T, Default>

    UnwrapOk<T, Default>: T extends Result<infer U>
        ? U
        : Default

    Type Parameters

    • T
    • Default = T
    +UnwrapOk | @wopjs/tsur - v0.1.3

    Type Alias UnwrapOk<T, Default>

    UnwrapOk<T, Default>: T extends Result<infer U>
        ? U
        : Default

    Type Parameters

    • T
    • Default = T
    diff --git a/types/index.UnwrapOption.html b/types/index.UnwrapOption.html index 9732487..4d1799b 100644 --- a/types/index.UnwrapOption.html +++ b/types/index.UnwrapOption.html @@ -1 +1 @@ -UnwrapOption | @wopjs/tsur - v0.1.3

    Type Alias UnwrapOption<T, Default>

    UnwrapOption<T, Default>: T extends Option<infer U>
        ? U
        : Default

    Type Parameters

    • T
    • Default = T
    +UnwrapOption | @wopjs/tsur - v0.1.3

    Type Alias UnwrapOption<T, Default>

    UnwrapOption<T, Default>: T extends Option<infer U>
        ? U
        : Default

    Type Parameters

    • T
    • Default = T
    diff --git a/variables/index.None-1.html b/variables/index.None-1.html index 17c961d..26ab526 100644 --- a/variables/index.None-1.html +++ b/variables/index.None-1.html @@ -1,2 +1,2 @@ None | @wopjs/tsur - v0.1.3

    Variable NoneConst

    None: None = ...

    The None value.

    -
    +