Constructor of KoconutPair
Class KoconutPair implements KoconutEquatable. The equality check process is done by using 'equalsTo method of Pair'
Processes all the chained objects and calls the specified function
block
with the result value as its argument and returns the original result.
1.0.10
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()
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
.
1.0.10
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()
Processes all the chained objects ane returns Promise<void>
.
1.0.10
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()
Processes all the chained object and returns original KoconutPair instance.
1.0.15
const koconutPair = await new KoconutPair(0, 1)
.retrieve()
console.log(koconutPair)
// ↑ KoconutPair {
// isValidated: true,
// data: Pair { firstElement: 0, secondElement: 1 }
// }
Processes all the chained objects and return the result.
1.0.10
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()
Generated using TypeDoc
Koconut Wrapper class for Pair
See