Class KoconutEntry<KeyType, ValueType>

Koconut Wrapper class for Entry.

See

-- Base --
[Entry](Entry.html), [Pair](Pair.html), [KoconutPair](KoconutPair.html)

-- Container --
[KoconutMap](KoconutMap.html)

-- Protocol --
[KoconutEquatable](../interfaces/KoconutEquatable.html)

Type Parameters

  • KeyType

    Check for Entry.

  • ValueType

    Check for Entry.

Hierarchy

Implements

Constructors

Methods - Other

Methods - Processor

Constructors

Other Methods

Processor Methods

  • 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: Processor<Entry<KeyType, ValueType>>

      A callback function that accepts an argument.

    Returns Promise<null | Entry<KeyType, ValueType>>

  • 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: Selector<Entry<KeyType, ValueType>, ReturnType>

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

    Returns Promise<ReturnType>

  • 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>

  • 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<Entry<KeyType, ValueType>>

Generated using TypeDoc