All

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2025 License: MIT Imports: 0 Imported by: 0

README

All

All determines whether all items emitted by an Observable meet some criteria.

Pass a predicate function to the All operator that accepts an item emitted by the source Observable and returns a boolean value based on an evaluation of that item. All returns an ObservableBool that emits a single boolean value: true if and only if the source Observable terminates normally and every item emitted by the source Observable evaluated as true according to the predicate; false if any item emitted by the source Observable evaluates as false according to the predicate.

All

Example

import _ "github.com/reactivego/rx/generic"

Code:

LessThan5 := func(i int) bool {
	return i < 5
}
FromInt(1, 2, 6, 2, 1).All(LessThan5).Println("All values less than 5?")

Output:

All values less than 5? false

Documentation

Overview

All determines whether all items emitted by an Observable meet some criteria.

Pass a predicate function to the All operator that accepts an item emitted by the source Observable and returns a boolean value based on an evaluation of that item. All returns an ObservableBool that emits a single boolean value: true if and only if the source Observable terminates normally and every item emitted by the source Observable evaluated as true according to the predicate; false if any item emitted by the source Observable evaluates as false according to the predicate.

Example (All)
LessThan5 := func(i int) bool {
	return i < 5
}
FromInt(1, 2, 6, 2, 1).All(LessThan5).Println("All values less than 5?")
Output:

All values less than 5? false

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL