bitbybit.dev v1.0.0-rc.1
    Preparing search index...

    Class Logic

    Index

    Constructors

    create

    • Creates and returns a boolean value (pass-through for boolean input). Example: true → true, false → false

      Parameters

      Returns boolean

      boolean

      boolean

      false

    • Generates a random boolean list where each value has a threshold chance of being true. Example: length=5, threshold=0.7 → might produce [true, true, false, true, true]

      Parameters

      Returns boolean[]

      booleans

      random booleans

      false

    • Converts numbers to booleans using two thresholds with gradient randomization between them. Values below trueThreshold → always true, above falseThreshold → always false. Between thresholds → probability gradient (closer to false threshold = higher chance of false). Example: [0.1, 0.4, 0.6, 0.9] with thresholds [0.3, 0.7] → [true, gradient, gradient, false]

      Parameters

      Returns boolean[]

      booleans

      2 threshold random gradient

      false

    • Converts numbers to booleans based on a threshold (below threshold → true, above → false). Can be inverted to flip the logic. Example: [0.3, 0.7, 0.5] with threshold=0.6 → [true, false, true]

      Parameters

      Returns boolean[]

      booleans

      threshold boolean list

      false

    • Converts numbers to booleans using multiple range thresholds (gaps define true ranges). Values within any gap range → true, outside all gaps → false. Can be inverted. Example: [0.2, 0.5, 0.8] with gaps [[0.3, 0.6], [0.7, 0.9]] → [false, true, true]

      Parameters

      Returns boolean[]

      booleans

      threshold gaps boolean list

      false

    edit

    • Applies NOT operator to flip a boolean value. Example: true → false, false → true

      Parameters

      Returns boolean

      boolean

      not

      false

    • Applies NOT operator to flip all boolean values in a list. Example: [true, false, true] → [false, true, false]

      Parameters

      Returns boolean[]

      booleans

      not list

      false

    operations

    • Compares two values using various operators (==, !=, ===, !==, <, <=, >, >=). Example: 5 > 3 → true, 'hello' === 'world' → false

      Type Parameters

      • T

      Parameters

      Returns boolean

      Result of the comparison

      compare

      false

    • Conditionally passes a value through if boolean is true, otherwise returns undefined. Example: value=42, boolean=true → 42, value=42, boolean=false → undefined

      Type Parameters

      • T

      Parameters

      Returns T

      value or undefined

      value gate

      false

    • Returns the first defined (non-undefined) value from two options (fallback pattern). Example: value1=42, value2=10 → 42, value1=undefined, value2=10 → 10

      Type Parameters

      • T
      • U

      Parameters

      Returns T | U

      value or undefined

      first defined value gate

      false