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()
A callback function that accepts an argument. The method calls the block
and returns its result.
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 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
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