Skip to content

Commit

Permalink
Made doc work again
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-van committed Nov 5, 2021
1 parent 18fd724 commit 5482f99
Show file tree
Hide file tree
Showing 36 changed files with 78 additions and 114 deletions.
2 changes: 1 addition & 1 deletion docs/versions.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"versions":["1.1.0","1.0.4","1.0.3","1.0.2","1.0.1","1.0.0"]}
{"versions":["1.0.4","1.0.3","1.0.2","1.0.1","1.0.0"]}
22 changes: 11 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"devDependencies": {
"@rollup/plugin-commonjs": "^21.0.1",
"@rollup/plugin-node-resolve": "^13.0.6",
"clean-jsdoc-theme": "^3.0.3",
"clean-jsdoc-theme": "3.0.3",
"eslint": "^7.32.0",
"eslint-config-standard": "^16.0.3",
"eslint-plugin-compat": "^3.13.0",
Expand Down
5 changes: 2 additions & 3 deletions src/Deferred.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* Instances of this class are never returned by any function of this library but it is used
* internally and can be useful to code other asynchronous helpers.
*
* @typedef T
* @example
* import { Deferred, sleep } from 'modern-async'
*
Expand All @@ -31,8 +30,8 @@ class Deferred {
/**
* (Read-only) The promise.
*
* @member {Promise<T>}
* @returns {Promise<T>} ignored
* @member {Promise}
* @returns {Promise} ignored
*/
get promise () {
return this._promise
Expand Down
8 changes: 3 additions & 5 deletions src/Queue.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,11 @@ class Queue {
* Puts a task at the end of the queue. When the task is executed and completes the returned promise will be terminated
* accordingly.
*
* @typedef M
* @param {Function} fct An asynchronous functions representing the task. It will be executed when the queue has
* available slots and its result will be propagated to the promise returned by exec().
* @param {number} priority (Optional) The priority of the task. The higher the priority is, the sooner the task will be
* @param {number} [priority] The priority of the task. The higher the priority is, the sooner the task will be
* executed regarding the priority of other pending tasks. Defaults to 0.
* @returns {Promise<M>} A promise that will be resolved or rejected once the task has completed. Its state will be the same
* @returns {Promise} A promise that will be resolved or rejected once the task has completed. Its state will be the same
* than the promise returned by the call to `fct`.
*/
async exec (fct, priority = 0) {
Expand All @@ -106,10 +105,9 @@ class Queue {
* but only if it wasn't started yet. Calling the cancel function on a task that it already running has no effect.
* When a task is cancelled its corresponding promise will be rejected with a `CancelledError`.
*
* @typedef M
* @param {Function} fct An asynchronous functions representing the task. It will be executed when the queue has
* available slots and its result will be propagated to the promise returned by exec().
* @param {number} priority (Optional) The priority of the task. The higher the priority is, the sooner the task will be
* @param {number} [priority] The priority of the task. The higher the priority is, the sooner the task will be
* executed regarding the priority of other pending tasks. Defaults to 0.
* @returns {Array} A tuple with two parameters:
* * `promise`: A promise that will be resolved or rejected once the task has completed. Its state will be the same
Expand Down
2 changes: 1 addition & 1 deletion src/Scheduler.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Scheduler {
*
* @param {Function} fct The asynchronous function to call when the scheduler is triggered.
* @param {number} delay The delay between two triggering of the scheduler, in ms.
* @param {{startImmediate: boolean, concurrency: number, maxPending: number}} options (Optional) An object that can contain additional options:
* @param {{startImmediate: boolean, concurrency: number, maxPending: number}} [options] An object that can contain additional options:
*
* * `startImmediate`: If true a new task will be triggered as soon as the start() method is called.
* Defaults to ´false`.
Expand Down
5 changes: 2 additions & 3 deletions src/asyncIterableWrap.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
/**
* Wraps an iterable or async iterable into an iterable that is guaranted to be async.
*
* @typedef T
* @param {Iterable<T> | AsyncIterable<T>} iterable An iterable or async iterable object.
* @yields {T} The elements returned by the original iterable.
* @param {Iterable | AsyncIterable} iterable An iterable or async iterable object.
* @yields {any} The elements returned by the original iterable.
* @example
* import { asyncIterableWrap } from 'modern-async'
*
Expand Down
2 changes: 1 addition & 1 deletion src/asyncRoot.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import asyncWrap from './asyncWrap.mjs'
* This function is trivial but useful when you can't use top-level await for compatibility reasons.
*
* @param {Function} fct An asynchronous function to call.
* @param {Function} errorHandler (Optional) A facultative error handler. This function will receive a single argument:
* @param {Function} [errorHandler] A facultative error handler. This function will receive a single argument:
* the thrown exception. The default behavior is to output the exception in the console.
* @example
* import { asyncRoot } from 'modern-async'
Expand Down
3 changes: 1 addition & 2 deletions src/every.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import everyLimit from './everyLimit.mjs'
* with the exception. In the very specific case where a test returns `false` and an already started task throws
* an exception that exception will be plainly ignored.
*
* @typedef V
* @param {Iterable<V> | AsyncIterable<V>} iterable An iterable or async iterable object.
* @param {Iterable | AsyncIterable} iterable An iterable or async iterable object.
* @param {Function} iteratee A function that will be called with each member of the iterable. It will receive
* three arguments:
* * `value`: The current value to process
Expand Down
5 changes: 2 additions & 3 deletions src/everyLimit.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@ import assert from 'nanoassert'
* tasks will also be cancelled. In the very specific case where a test returns `false` and an
* already started task throws an exception that exception will be plainly ignored.
*
* @typedef V
* @param {Iterable<V> | AsyncIterable<V>} iterable An iterable or async iterable object.
* @param {Iterable | AsyncIterable} iterable An iterable or async iterable object.
* @param {Function} iteratee A function that will be called with each member of the iterable. It will receive
* three arguments:
* * `value`: The current value to process
* * `index`: The index in the iterable. Will start from 0.
* * `iterable`: The iterable on which the operation is being performed.
* @param {Queue | number} queueOrConcurrency If a queue is specified it will be used to schedule the calls to
* @param {Queue | number} [queueOrConcurrency] If a queue is specified it will be used to schedule the calls to
* `iteratee`. If a number is specified it will be used as the concurrency of a Queue that will be created
* implicitly for the same purpose.
* @returns {Promise<boolean>} A promise that will be resolved to `true` if all values pass the truth test and `false`
Expand Down
3 changes: 1 addition & 2 deletions src/everySeries.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import everyLimit from './everyLimit.mjs'
* In case of exception in one of the iteratee calls the promise returned by this function will be
* rejected with the exception and the remaining pending tasks will be cancelled.
*
* @typedef V
* @param {Iterable<V> | AsyncIterable<V>} iterable An iterable or async iterable object.
* @param {Iterable | AsyncIterable} iterable An iterable or async iterable object.
* @param {Function} iteratee A function that will be called with each member of the iterable. It will receive
* three arguments:
* * `value`: The current value to process
Expand Down
5 changes: 2 additions & 3 deletions src/filter.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ import filterLimit from './filterLimit.mjs'
*
* If any of the calls to `iteratee` throws an exception the returned promise will be rejected.
*
* @typedef V
* @param {Iterable<V> | AsyncIterable<V>} iterable An iterable or async iterable object.
* @param {Iterable | AsyncIterable} iterable An iterable or async iterable object.
* @param {Function} iteratee A function that will be called with each member of `iterable`. It will receive
* three arguments:
* * `value`: The current value to process
* * `index`: The index in the iterable. Will start from 0.
* * `iterable`: The iterable on which the operation is being performed.
* @returns {Promise<V[]>} A promise that will be resolved with an array containing all the values that passed
* @returns {Promise<any[]>} A promise that will be resolved with an array containing all the values that passed
* the truth test. This promise will be rejected if any of the `iteratee` calls throws an exception.
* @example
* import { filter, sleep } from 'modern-async'
Expand Down
9 changes: 4 additions & 5 deletions src/filterGenerator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,19 @@ import asyncWrap from './asyncWrap.mjs'
* If `iterable` or any of the calls to `iteratee` throws an exception all pending tasks will be cancelled and the
* returned async iterator will throw that exception.
*
* @typedef V
* @param {Iterable<V> | AsyncIterable<V>} iterable An iterable or async iterable object.
* @param {Iterable | AsyncIterable} iterable An iterable or async iterable object.
* @param {Function} iteratee A function that will be called with each member of the iterable. It will receive
* three arguments:
* * `value`: The current value to process
* * `index`: The index in the iterable. Will start from 0.
* * `iterable`: The iterable on which the operation is being performed.
* @param {Queue | number} queueOrConcurrency Defaults to `1`. If a queue is specified it will be used to schedule the calls to
* @param {Queue | number} [queueOrConcurrency] If a queue is specified it will be used to schedule the calls to
* `iteratee`. If a number is specified it will be used as the concurrency of a Queue that will be created
* implicitly for the same purpose.
* @param {boolean} ordered Defaults to `true`. If true the results will be yieled in the same order as in the source
* @param {boolean} [ordered] If true the results will be yieled in the same order as in the source
* iterable, regardless of which calls to iteratee returned first. If false the the results will be yielded as soon
* as a call to iteratee returned.
* @yields {V} Each element of `iterable` for which `iteratee` returned `true`.
* @yields {any} Each element of `iterable` for which `iteratee` returned `true`.
* @example
* TODO
*/
Expand Down
5 changes: 2 additions & 3 deletions src/filterLimit.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import filterGenerator from './filterGenerator.mjs'
* If any of the calls to `iteratee` throws an exception the returned promise will be rejected and the remaining
* pending tasks will be cancelled.
*
* @typedef V
* @param {Iterable<V> | AsyncIterable<V>} iterable An iterable or async iterable object.
* @param {Iterable | AsyncIterable} iterable An iterable or async iterable object.
* @param {Function} iteratee A function that will be called with each member of `iterable`. It will receive
* three arguments:
* * `value`: The current value to process
Expand All @@ -22,7 +21,7 @@ import filterGenerator from './filterGenerator.mjs'
* @param {Queue | number} queueOrConcurrency If a queue is specified it will be used to schedule the calls to
* `iteratee`. If a number is specified it will be used as the concurrency of a Queue that will be created
* implicitly for the same purpose.
* @returns {Promise<V[]>} A promise that will be resolved with an array containing all the values that passed
* @returns {Promise<any[]>} A promise that will be resolved with an array containing all the values that passed
* the truth test. This promise will be rejected if any of the `iteratee` calls throws an exception.
* @example
* import { filterLimit, sleep } from 'modern-async'
Expand Down
5 changes: 2 additions & 3 deletions src/filterSeries.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@ import filterLimit from './filterLimit.mjs'
* If any of the calls to `iteratee` throws an exception the returned promise will be rejected and the remaining
* pending tasks will be cancelled.
*
* @typedef V
* @param {Iterable<V> | AsyncIterable<V>} iterable An iterable or async iterable object.
* @param {Iterable | AsyncIterable} iterable An iterable or async iterable object.
* @param {Function} iteratee A function that will be called with each member of the iterable. It will receive
* three arguments:
* * `value`: The current value to process
* * `index`: The index in the iterable. Will start from 0.
* * `iterable`: The iterable on which the operation is being performed.
* @returns {Promise<V[]>} A promise that will be resolved with an array containing all the values that passed
* @returns {Promise<any[]>} A promise that will be resolved with an array containing all the values that passed
* the truth test. This promise will be rejected if any of the `iteratee` calls throws an exception.
* @example
* import { filterSeries, sleep } from 'modern-async'
Expand Down
7 changes: 3 additions & 4 deletions src/find.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@ import findLimit from './findLimit.mjs'
* rejected with the exception. In the very specific case where a result is found and an
* already started task throws an exception that exception will be plainly ignored.
*
* @typedef V
* @param {Iterable<V> | AsyncIterable<V>} iterable An iterable or async iterable object.
* @param {Iterable | AsyncIterable} iterable An iterable or async iterable object.
* @param {Function} iteratee A function that will be called with each member of the iterable. It will receive
* three arguments:
* * `value`: The current value to process
* * `index`: The index in the iterable. Will start from 0.
* * `iterable`: The iterable on which the operation is being performed.
* @param {boolean} ordered Defaults to `false`. If true this function will return on the first element in the iterable
* @param {boolean} [ordered] If true this function will return on the first element in the iterable
* order for which `iteratee` returned true. If false it will be the first in time.
* @returns {Promise<V | undefined>} A promise that will be resolved with the first found value or rejected if one of the
* @returns {Promise<any | undefined>} A promise that will be resolved with the first found value or rejected if one of the
* `iteratee` calls throws an exception before finding a value. If no value is found it will return `undefined`.
* @example
* import { find, sleep } from 'modern-async'
Expand Down
5 changes: 2 additions & 3 deletions src/findIndex.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ import findIndexLimit from './findIndexLimit.mjs'
* rejected with the exception. In the very specific case where a result is found and an
* already started task throws an exception that exception will be plainly ignored.
*
* @typedef V
* @param {Iterable<V> | AsyncIterable<V>} iterable An iterable or async iterable object.
* @param {Iterable | AsyncIterable} iterable An iterable or async iterable object.
* @param {Function} iteratee A function that will be called with each member of the iterable. It will receive
* three arguments:
* * `value`: The current value to process
* * `index`: The index in the iterable. Will start from 0.
* * `iterable`: The iterable on which the operation is being performed.
* @param {boolean} ordered Defaults to `false`. If true this function will return on the first element in the iterable
* @param {boolean} [ordered] If true this function will return on the first element in the iterable
* order for which `iteratee` returned true. If false it will be the first in time.
* @returns {Promise<number>} A promise that will be resolved with the index of the first found value or rejected if one of the
* `iteratee` calls throws an exception before finding a value. If no value is found it will return `-1`.
Expand Down
5 changes: 2 additions & 3 deletions src/findIndexLimit.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ import Queue from './Queue.mjs'
* tasks will also be cancelled. In the very specific case where a result is found and an
* already started task throws an exception that exception will be plainly ignored.
*
* @typedef V
* @param {Iterable<V> | AsyncIterable<V>} iterable An iterable or async iterable object.
* @param {Iterable | AsyncIterable} iterable An iterable or async iterable object.
* @param {Function} iteratee A function that will be called with each member of the iterable. It will receive
* three arguments:
* * `value`: The current value to process
Expand All @@ -23,7 +22,7 @@ import Queue from './Queue.mjs'
* @param {Queue | number} queueOrConcurrency If a queue is specified it will be used to schedule the calls to
* `iteratee`. If a number is specified it will be used as the concurrency of a Queue that will be created
* implicitly for the same purpose.
* @param {boolean} ordered Defaults to `false`. If true this function will return on the first element in the iterable
* @param {boolean} [ordered] If true this function will return on the first element in the iterable
* order for which `iteratee` returned true. If false it will be the first in time.
* @returns {Promise<number>} A promise that will be resolved with the index of the first found value or rejected if one of the
* `iteratee` calls throws an exception before finding a value. If no value is found it will return `-1`.
Expand Down
3 changes: 1 addition & 2 deletions src/findIndexSeries.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import findIndexLimit from './findIndexLimit.mjs'
* In case of exception in one of the `iteratee` calls the promise returned by this function will be
* rejected with the exception and the remaining pending tasks will be cancelled.
*
* @typedef V
* @param {Iterable<V> | AsyncIterable<V>} iterable An iterable or async iterable object.
* @param {Iterable | AsyncIterable} iterable An iterable or async iterable object.
* @param {Function} iteratee A function that will be called with each member of the iterable. It will receive
* three arguments:
* * `value`: The current value to process
Expand Down
Loading

0 comments on commit 5482f99

Please sign in to comment.