Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • KoconutPrimitive<boolean>
    • KoconutBoolean

Implements

Index

Constructors

Other Methods

Processor Methods

Constructors

constructor

  • Creates a new instance from boolean.

    since

    1.0.15

    example
    const koconutBoolean = await new KoconutBoolean(true)
    // ↑ This is a KoconutBoolean instance, of which value is true.
    
    const koconutBoolean = await new KoconutBoolean()
    // ↑ This is a KoconutBoolean instance, of which value is false.

    Parameters

    • Default value boolean: boolean | null = null

      A boolean value which is eiter true or false. If it's omitted false is default value.

    Returns KoconutBoolean

Other Methods

and

compareTo

  • compareTo(other: targetBooleanLikeType): KoconutPrimitive<number>

eqv

nand

nor

not

or

xnor

xor

Processor Methods

also

  • also(block: (data: boolean) => void | Promise<void>): Promise<boolean | null>
  • Processes all the chained objects and calls the specified function block with the result value as its argument and returns the original result.

    since

    1.0.10

    example
    import { KoconutArray } from 'koconut'
    
    const mainProcess = async () => {
      const koconutNumbers = KoconutArray.of(1,2,3,4,5)
    
      const moreNumbers = await koconutNumbers
                              .also(result => {
                                  result.push(6)
                                  result.push(7)
                                  result.push(8)
                              })
      console.log(moreNumbers)
      // ↑ [1, 2, 3, 4, 5, 6, 7, 8]
    }
    mainProcess()

    Parameters

    • block: (data: boolean) => void | Promise<void>

      A callback function that accepts an argument.

        • (data: boolean): void | Promise<void>
        • Parameters

          • data: boolean

          Returns void | Promise<void>

    Returns Promise<boolean | null>

let

  • let<ReturnType>(block: (data: boolean) => ReturnType | Promise<ReturnType>): Promise<ReturnType>
  • Processes all the chained objects and calls the specified function block with the result value as its argument and returns the final result of the block.

    since

    1.0.10

    example
    import { KoconutArray } from 'koconut'
    
    const mainProcess = async () => {
      const koconutNumbers = KoconutArray.of(1,2,3,4,5)
    
      const firstNumberPlus2 = await koconutNumbers
                              .first()
                              .let(result => result + 2)
      console.log(firstNumber)
      // ↑ 3
    }
    mainProcess()

    Type parameters

    • ReturnType

    Parameters

    • block: (data: boolean) => ReturnType | Promise<ReturnType>

      A callback function that accepts an argument. The method calls the block and returns its result.

        • (data: boolean): ReturnType | Promise<ReturnType>
        • Parameters

          • data: boolean

          Returns ReturnType | Promise<ReturnType>

    Returns Promise<ReturnType>

process

  • process(): Promise<void>
  • Processes all the chained objects ane returns Promise<void>.

    since

    1.0.10

    example
    import { KoconutArray } from 'koconut'
    
    const mainProcess = async () => {
      const koconutNumbers = KoconutArray.of(1,2,3,4,5)
    
      await koconutNumbers
                  .forEach(console.log)
                  .process()
      // ↑ 1 2 3 4 5
    }
    mainProcess()

    Returns Promise<void>

retrieve

yield

  • yield(): Promise<boolean>
  • Processes all the chained objects and return the result.

    since

    1.0.10

    example
    import { KoconutArray } from 'koconut'
    
    const mainProcess = async () => {
      const koconutNumbers = KoconutArray.of(1,2,3,4,5)
    
      const firstNumber = await koconutNumbers
                                          .first()
                                          .yield()
      console.log(firstNumber)
      // ↑ 1
    }
    mainProcess()

    Returns Promise<boolean>

Generated using TypeDoc