Skip to content

Commit

Permalink
Use more specific callback types (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
domfarolino authored Sep 7, 2023
1 parent 691e410 commit 0d411ab
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,10 @@ interface Subscriber {

callback Predicate = boolean (any value);
callback Reducer = any (any accumulator, any currentValue)
callback Mapper = any (any element, unsigned long long index)
// Differs from `Mapper` only in return type, since this callback is exclusively
// used to visit each element in a sequence, not transform it.
callback Visitor = undefined (any element, unsigned long long index)

[Exposed=*]
interface Observable {
Expand All @@ -322,15 +326,14 @@ interface Observable {
undefined finally(VoidFunction callback);

// Observable-returning operators. See "Operators" section below.
// TODO: Use more specific callback types than `Function`.
Observable takeUntil(Observable notifier);
Observable map(Function project);
Observable map(Mapper mapper);
Observable filter(Predicate predicate);
Observable take(unsigned long long);
Observable drop(unsigned long long);
Observable flatMap(Function project);
Observable flatMap(Mapper mapper);
Promise<sequence<any>> toArray(optional PromiseOptions options);
Promise<undefined> forEach(Function callback, optional PromiseOptions options);
Promise<undefined> forEach(Visitor callback, optional PromiseOptions options);

// Promise-returning. See "Concerns" section below.
Promise<any> every(Predicate predicate, optional PromiseOptions options);
Expand Down

0 comments on commit 0d411ab

Please sign in to comment.