From 6f86caba2f4d700c127a8f509d40d7d6c5af7d9f Mon Sep 17 00:00:00 2001 From: crimx Date: Wed, 18 Oct 2023 08:33:51 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20wopjs/ts?= =?UTF-8?q?ur@a10df641feb8e786c2bafc6c879ff891a0bbdcb0=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- classes/index.Option.html | 72 +++++++++++++------------- classes/index.Result.html | 80 ++++++++++++++--------------- functions/index.Err-1.html | 10 ++-- functions/index.Ok-1.html | 10 ++-- functions/index.Some-1.html | 10 ++-- functions/index.filterMap.html | 10 ++-- functions/index.first.html | 10 ++-- functions/index.firstIndex.html | 10 ++-- functions/index.firstMap.html | 10 ++-- functions/index.last.html | 10 ++-- functions/index.lastIndex.html | 10 ++-- functions/index.lastMap.html | 10 ++-- functions/index.mapWhile.html | 10 ++-- functions/index.reduceWhile.html | 10 ++-- index.html | 30 +++++------ interfaces/index.ResultMatcher.html | 14 ++--- interfaces/patches_array.Array.html | 28 +++++----- modules/index.html | 10 ++-- modules/patches_array.html | 10 ++-- types/index.Err.html | 12 ++--- types/index.None.html | 12 ++--- types/index.Ok.html | 12 ++--- types/index.Some.html | 12 ++--- types/index.UnwrapErr.html | 10 ++-- types/index.UnwrapOk.html | 10 ++-- types/index.UnwrapOption.html | 10 ++-- variables/index.None-1.html | 12 ++--- 27 files changed, 227 insertions(+), 227 deletions(-) diff --git a/classes/index.Option.html b/classes/index.Option.html index f9c335c..2547453 100644 --- a/classes/index.Option.html +++ b/classes/index.Option.html @@ -1,4 +1,4 @@ -Option | tsur - v0.1.0
+Option | @wopjs/tsur - v0.0.1
  • Preparing search index...
  • -
  • The search index is not available
tsur - v0.1.0
+
  • The search index is not available
  • @wopjs/tsur - v0.0.1

    Class Option<T>

    @@ -31,7 +31,7 @@

    Hierarchy

    • Option
    +
  • Defined in option.ts:17
  • @@ -80,7 +80,7 @@
    +
  • Defined in option.ts:28
  • Methods

    @@ -94,7 +94,7 @@
    +
  • Defined in option.ts:90
    • @@ -118,7 +118,7 @@

      Returns

    +
  • Defined in option.ts:139
    • @@ -157,7 +157,7 @@

      Returns

    +
  • Defined in option.ts:149
  • +
  • Defined in option.ts:248
  • +
  • Defined in option.ts:234
  • +
  • Defined in option.ts:106
  • +
  • Defined in option.ts:126
    • @@ -247,7 +247,7 @@

      Returns boolean

    +
  • Defined in option.ts:99
  • +
  • Defined in option.ts:116
  • +
  • Defined in option.ts:261
  • +
  • Defined in option.ts:352
  • +
  • Defined in option.ts:289
  • +
  • Defined in option.ts:299
  • +
  • Defined in option.ts:163
  • +
  • Defined in option.ts:173
  • +
  • Defined in option.ts:356
  • +
  • Defined in option.ts:274
  • +
  • Defined in option.ts:312
  • @@ -562,7 +562,7 @@

    Returns

  • +
  • Defined in option.ts:330
  • +
  • Defined in option.ts:341
  • +
  • Defined in option.ts:222
  • +
  • Defined in option.ts:182
  • +
  • Defined in option.ts:193
  • +
  • Defined in option.ts:207
  • +
  • Defined in option.ts:22
  • Wrap a value in an Option if the value satisfies the predicate.

    @@ -790,7 +790,7 @@
    Optional Returns Option<T>
  • +
  • Defined in option.ts:43
  • Wrap a value in an Option if the value satisfies the predicate.

    @@ -831,7 +831,7 @@
    Optional Returns Option<T>
  • +
  • Defined in option.ts:54
    • @@ -854,7 +854,7 @@

      Returns maybeOpti

    +
  • Defined in option.ts:74
  • Class Result<T, E>

    @@ -32,7 +32,7 @@

    Hierarchy

    • Result
    +
  • Defined in result.ts:19
  • @@ -85,7 +85,7 @@
    +
  • Defined in result.ts:136
    • @@ -105,7 +105,7 @@

      Parameters

      resultB: Result<BT, BE>

    Returns Result<BT, E | BE>

    +
  • Defined in result.ts:196
    • @@ -146,7 +146,7 @@

      Returns

    +
  • Defined in result.ts:206
  • +
  • Defined in result.ts:302
  • +
  • Defined in result.ts:242
  • +
  • Defined in result.ts:152
  • +
  • Defined in result.ts:168
  • +
  • Defined in result.ts:145
  • +
  • Defined in result.ts:160
  • +
  • Defined in result.ts:178
  • +
  • Defined in result.ts:190
  • +
  • Defined in result.ts:256
  • +
  • Defined in result.ts:271
  • +
  • Defined in result.ts:393
  • +
  • Defined in result.ts:295
  • +
  • Defined in result.ts:222
  • +
  • Defined in result.ts:232
  • +
  • Defined in result.ts:397
  • +
  • Defined in result.ts:284
  • +
  • Defined in result.ts:313
  • +
  • Defined in result.ts:352
  • @@ -593,7 +593,7 @@

    Returns

  • +
  • Defined in result.ts:372
  • +
  • Defined in result.ts:382
  • @@ -658,7 +658,7 @@

    Returns

  • +
  • Defined in result.ts:331
  • +
  • Defined in result.ts:341
  • +
  • Defined in result.ts:31
  • +
  • Defined in result.ts:24
  • OK if the value satisfies the predicate, otherwise Err

    @@ -809,7 +809,7 @@
    Optional Returns Result<T, E>
  • +
  • Defined in result.ts:49
  • OK if the value satisfies the predicate, otherwise Err

    @@ -853,7 +853,7 @@
    Optional Returns Result<T, E>
  • +
  • Defined in result.ts:62
  • +
  • Defined in result.ts:116
  • +
  • Defined in result.ts:84
  • +
  • Defined in result.ts:100
  • Function Err

    @@ -39,7 +39,7 @@

    Returns

    +
  • Defined in result.ts:31
  • Function Ok

    @@ -39,7 +39,7 @@

    Returns

    +
  • Defined in result.ts:24
  • Function Some

    @@ -37,7 +37,7 @@

    Returns

    +
  • Defined in option.ts:22
  • Function filterMap

    @@ -67,7 +67,7 @@

    Returns

    +
  • Defined in array.ts:14
  • Function first

    @@ -64,7 +64,7 @@

    Returns

    +
  • Defined in array.ts:123
  • Function firstIndex

    @@ -64,7 +64,7 @@

    Returns

    +
  • Defined in array.ts:93
  • Function firstMap

    @@ -67,7 +67,7 @@

    Returns

    +
  • Defined in array.ts:153
  • Function last

    @@ -64,7 +64,7 @@

    Returns

    +
  • Defined in array.ts:137
  • Function lastIndex

    @@ -64,7 +64,7 @@

    Returns

    +
  • Defined in array.ts:108
  • Function lastMap

    @@ -66,7 +66,7 @@

    Returns

    +
  • Defined in array.ts:175
  • Function mapWhile

    @@ -66,7 +66,7 @@

    Returns

    +
  • Defined in array.ts:37
  • Function reduceWhile

    @@ -73,7 +73,7 @@

    Returns

    +
  • Defined in array.ts:62
  • -

    tsur - v0.1.0

    -

    tsur

    - +

    @wopjs/tsur - v0.0.1

    +

    tsur

    +

    -

    Docs -Build Status -npm-version -Coverage Status

    +

    Docs +Build Status +npm-version +Coverage Status

    TypeScript goodies inspired by Rust.

    This project draws inspiration from Rust, but is designed to be more ergonomic and tailored to TypeScript's features and syntax.

    -

    Install

    npm add tsur
    +

    Install

    npm add @wopjs/tsur
     
    -

    Usage

    Option

    import { Option, Some, None } from "tsur";

    const maybeNumber = Some(42);

    if (maybeNumber.isSome()) {
    console.log(maybeNumber.unwrap()); // 42
    } else {
    console.log("There is no number");
    }

    const maybeString = None;

    if (maybeString.isSome()) {
    console.log(maybeString.unwrap());
    } else {
    console.log("There is no string"); // "There is no string"
    } +

    Usage

    Option

    import { Option, Some, None } from "@wopjs/tsur";

    const maybeNumber = Some(42);

    if (maybeNumber.isSome()) {
    console.log(maybeNumber.unwrap()); // 42
    } else {
    console.log("There is no number");
    }

    const maybeString = None;

    if (maybeString.isSome()) {
    console.log(maybeString.unwrap());
    } else {
    console.log("There is no string"); // "There is no string"
    }
    -

    Result

    import { Result, Ok, Err } from "tsur";

    function divide(a: number, b: number): Result<number, string> {
    if (b === 0) {
    return Err("Cannot divide by zero");
    }
    return Ok(a / b);
    }

    const result = divide(10, 2);

    if (result.isOk()) {
    console.log(result.unwrap()); // 5
    } else {
    console.log(result.unwrapErr()); // "Cannot divide by zero"
    } +

    Result

    import { Result, Ok, Err } from "@wopjs/tsur";

    function divide(a: number, b: number): Result<number, string> {
    if (b === 0) {
    return Err("Cannot divide by zero");
    }
    return Ok(a / b);
    }

    const result = divide(10, 2);

    if (result.isOk()) {
    console.log(result.unwrap()); // 5
    } else {
    console.log(result.unwrapErr()); // "Cannot divide by zero"
    }

    Array

    Many useful array methods are added:

    -
    import { filterMap, Some, None } from "tsur";

    const arr = [1, 2, 3, 4, 5];

    const result = filterMap(arr, x => (x % 2 === 0 ? Some(x * 2) : None));

    console.log(result); // [4, 8] +
    import { filterMap, Some, None } from "@wopjs/tsur";

    const arr = [1, 2, 3, 4, 5];

    const result = filterMap(arr, x => (x % 2 === 0 ? Some(x * 2) : None));

    console.log(result); // [4, 8]

    Or you can patch them to the native array:

    -
    import "tsur/patches/array";

    const arr = [1, 2, 3, 4, 5];

    const result = arr.filterMap(x => (x % 2 === 0 ? Some(x * 2) : None));

    console.log(result); // [4, 8] +
    import "@wopjs/tsur/patches/array";

    const arr = [1, 2, 3, 4, 5];

    const result = arr.filterMap(x => (x % 2 === 0 ? Some(x * 2) : None));

    console.log(result); // [4, 8]

    See docs for more details.

    License

    MIT @ CRIMX

    @@ -63,7 +63,7 @@

    Array
  • License
  • diff --git a/interfaces/index.ResultMatcher.html b/interfaces/index.ResultMatcher.html index 19b09b8..ba862f8 100644 --- a/interfaces/index.ResultMatcher.html +++ b/interfaces/index.ResultMatcher.html @@ -1,4 +1,4 @@ -ResultMatcher | tsur - v0.1.0
    +ResultMatcher | @wopjs/tsur - v0.0.1
    • Preparing search index...
    • -
    • The search index is not available
    tsur - v0.1.0
    +
  • The search index is not available
  • @wopjs/tsur - v0.0.1

    Interface ResultMatcher<T, E, U>

    @@ -30,7 +30,7 @@

    Hierarchy

    • ResultMatcher
    +
  • Defined in result.ts:11
  • @@ -60,7 +60,7 @@

    Parameters

    error: E

    Returns U

    +
  • Defined in result.ts:13
  • Ok: ((value) => U)
    @@ -78,7 +78,7 @@

    Parameters

    value: T

    Returns U

    +
  • Defined in result.ts:12
  • Interface Array<T>

    @@ -26,7 +26,7 @@

    Hierarchy

    • Array
    +
  • Defined in patches/array.ts:16
  • @@ -92,7 +92,7 @@

    Returns

    +
  • Defined in patches/array.ts:28
    • @@ -133,7 +133,7 @@

      Returns

    +
  • Defined in patches/array.ts:105
  • +
  • Defined in patches/array.ts:77
  • +
  • Defined in patches/array.ts:135
  • +
  • Defined in patches/array.ts:119
  • +
  • Defined in patches/array.ts:91
  • +
  • Defined in patches/array.ts:149
  • +
  • Defined in patches/array.ts:42
  • +
  • Defined in patches/array.ts:57
  • Module index

    +
  • Defined in index.ts:1
  • Index

    @@ -67,7 +67,7 @@

    Theme

    Module patches/array

    +
  • Defined in patches/array.ts:1
  • Index

    @@ -33,7 +33,7 @@

    Theme

    Type alias Err<E>

    @@ -23,8 +23,8 @@

    Type Parameters

  • E

  • +
  • Defined in result.ts:413
  • +
  • Defined in result.ts:414
  • Type alias None

    None: Option<any>
    +
  • Defined in option.ts:371
  • +
  • Defined in option.ts:372
  • Type alias Ok<T>

    @@ -23,8 +23,8 @@

    Type Parameters

  • T

  • +
  • Defined in result.ts:406
  • +
  • Defined in result.ts:407
  • Type alias Some<T>

    @@ -23,8 +23,8 @@

    Type Parameters

  • T

  • +
  • Defined in option.ts:365
  • +
  • Defined in option.ts:366
  • Type alias UnwrapErr<E, Default>

    @@ -25,7 +25,7 @@

    E

  • Default = E

  • +
  • Defined in result.ts:7
  • Type alias UnwrapOk<T, Default>

    @@ -25,7 +25,7 @@

    T

  • Default = T

  • +
  • Defined in result.ts:6
  • Type alias UnwrapOption<T, Default>

    @@ -25,7 +25,7 @@

    T

  • Default = T

  • +
  • Defined in option.ts:9
  • Variable NoneConst

    @@ -21,8 +21,8 @@

    Variable NoneConst

    +
  • Defined in option.ts:371
  • +
  • Defined in option.ts:372