Skip to content

Commit

Permalink
Collection subclasses code comments [nocode]
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Apr 13, 2021
1 parent 10cd32e commit 24acfdd
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ const Collection = require('./collection.js'),
// Exports

class CollectionAll extends Collection {
/**
* Completes on first rejection.
* @param {number} status - `RESOLVED` or `REJECTED`
* @returns {boolean}
*/
resolveOrRejectCompletes(status) { // eslint-disable-line class-methods-use-this
return status === REJECTED;
}
Expand Down
4 changes: 4 additions & 0 deletions lib/allSettled.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ const Collection = require('./collection.js'),
// Exports

class CollectionAllSettled extends Collection {
/**
* Never completes until all are resolved/rejected.
* @returns {boolean}
*/
resolveOrRejectCompletes() { // eslint-disable-line class-methods-use-this
return false;
}
Expand Down
5 changes: 5 additions & 0 deletions lib/any.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ const Collection = require('./collection.js'),
const AggregateErr = createAggregateErrorClass();

class CollectionAny extends Collection {
/**
* Completes on first resolution.
* @param {number} status - `RESOLVED` or `REJECTED`
* @returns {boolean}
*/
resolveOrRejectCompletes(status) { // eslint-disable-line class-methods-use-this
return status === RESOLVED;
}
Expand Down
4 changes: 4 additions & 0 deletions lib/race.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ const Collection = require('./collection.js'),
// Exports

class CollectionRace extends Collection {
/**
* Completes on first resolution or rejection.
* @returns {boolean}
*/
resolveOrRejectCompletes() { // eslint-disable-line class-methods-use-this
return true;
}
Expand Down

0 comments on commit 24acfdd

Please sign in to comment.