Creates a new instance from boolean
.
1.0.15
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.
A boolean value which is either true or false. If it's omitted false
is default value.
Compares this instance with the target object. Result can be either simple number or KoconutPrimitive instance wrapping number value.
Returns zero -- This object equals to other. Returns negative number -- This object is less than other. Returns positive number -- This object is grater than other.
Target instance to compare.
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()
A callback function that accepts an argument.
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()
Processed all the chained object and returns original KoconutBoolean instance.
1.0.15
const koconutBoolean = await new KoconutBoolean(true)
.retrieve()
console.log(koconutBoolean)
// ↑ KoconutBoolean { isValidated: true, data: true }
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
Classes which inherit from this protocol have a defined total ordering between their instances