Skip to content

Commit cb9e2c0

Browse files
committed
Auto-generated commit
1 parent 821ef43 commit cb9e2c0

File tree

10 files changed

+124
-127
lines changed

10 files changed

+124
-127
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
<section class="release" id="unreleased">
66

7-
## Unreleased (2026-01-05)
7+
## Unreleased (2026-01-06)
88

99
<section class="features">
1010

@@ -25,6 +25,7 @@
2525

2626
### Bug Fixes
2727

28+
- [`d2d06f4`](https://github.com/stdlib-js/stdlib/commit/d2d06f45f5df1d830aa0a14331bd6b883d9992d5) - avoid infinite recursion and update examples
2829
- [`6d021ff`](https://github.com/stdlib-js/stdlib/commit/6d021ff12baa5380b83daffc78b7d64a308e1e9d) - markdown lint error in `utils/object-inverse` [(#9438)](https://github.com/stdlib-js/stdlib/pull/9438)
2930
- [`1b9a036`](https://github.com/stdlib-js/stdlib/commit/1b9a036d676b247bf502c4ede08635b99fa611ca) - allow correct values for `returns` option
3031
- [`eeb9d6f`](https://github.com/stdlib-js/stdlib/commit/eeb9d6fdc2e3faa3116c84f276e88737ba11196f) - remove unused imports
@@ -323,6 +324,7 @@ A total of 26 issues were closed in this release:
323324

324325
<details>
325326

327+
- [`d2d06f4`](https://github.com/stdlib-js/stdlib/commit/d2d06f45f5df1d830aa0a14331bd6b883d9992d5) - **fix:** avoid infinite recursion and update examples _(by Athan Reines)_
326328
- [`2fee906`](https://github.com/stdlib-js/stdlib/commit/2fee906e7981ff2a9a0bf37bfcbfe3b77421bfcd) - **docs:** resolve lint failures _(by Athan Reines)_
327329
- [`989e453`](https://github.com/stdlib-js/stdlib/commit/989e45330b4284265444e286a926a693ec8518aa) - **docs:** update copy _(by Athan Reines)_
328330
- [`c4671b1`](https://github.com/stdlib-js/stdlib/commit/c4671b1cef6f00d28d483cfb9b558d9c1d5f81c9) - **docs:** resolve lint failures _(by Athan Reines)_

parallel/README.md

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,6 @@ var writeFileSync = require( '@stdlib/fs/write-file' ).sync;
222222
var unlinkSync = require( '@stdlib/fs/unlink' ).sync;
223223
var parallel = require( '@stdlib/utils/parallel' );
224224

225-
var nFiles = 100;
226-
var files;
227-
var opts;
228-
var dir;
229-
230225
function template( id ) {
231226
var file = '';
232227

@@ -259,52 +254,54 @@ function createScripts( dir, nFiles ) {
259254
var files;
260255
var i;
261256

262-
files = new Array( nFiles );
257+
files = [];
263258
for ( i = 0; i < nFiles; i++ ) {
264259
content = template( i.toString() );
265260
fpath = path.join( dir, i+'.js' );
266261
writeFileSync( fpath, content, {
267262
'encoding': 'utf8'
268263
});
269-
files[ i ] = fpath;
264+
files.push( fpath );
270265
}
271266
return files;
272267
}
273268

274-
function cleanup() {
275-
var i;
276-
277-
// Delete the temporary files...
278-
for ( i = 0; i < files.length; i++ ) {
279-
unlinkSync( files[ i ] );
280-
}
281-
// Remove temporary directory:
282-
fs.rmdirSync( dir );
283-
}
284-
285-
function done( error ) {
286-
if ( error ) {
287-
throw error;
288-
}
289-
cleanup();
290-
console.log( 'Done!' );
291-
}
269+
var nFiles = 10;
292270

293-
// Make a temporary directory to store files...
294-
dir = createDir();
271+
// Make a temporary directory to store files:
272+
var dir = createDir();
295273

296-
// Create temporary files...
297-
files = createScripts( dir, nFiles );
274+
// Create temporary files:
275+
var files = createScripts( dir, nFiles );
298276

299277
// Set the runner options:
300-
opts = {
278+
var opts = {
301279
'concurrency': 3,
302280
'workers': 3,
303281
'ordered': false
304282
};
305283

306284
// Run all temporary scripts:
307285
parallel( files, opts, done );
286+
287+
function done( error ) {
288+
if ( error ) {
289+
console.log( error.message );
290+
}
291+
cleanup();
292+
console.log( 'Done!' );
293+
}
294+
295+
function cleanup() {
296+
var i;
297+
298+
// Delete the temporary files...
299+
for ( i = 0; i < files.length; i++ ) {
300+
unlinkSync( files[ i ] );
301+
}
302+
// Remove temporary directory:
303+
fs.rmdirSync( dir );
304+
}
308305
```
309306

310307
</section>

parallel/docs/repl.txt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,6 @@
5353
clbk: Function
5454
Callback to invoke after executing all scripts.
5555

56-
Examples
57-
--------
58-
> function done( error ) { if ( error ) { throw error; } };
59-
> var files = [ './a.js', './b.js' ];
60-
> {{alias}}( files, done );
61-
62-
// Specify the number of workers:
63-
> var opts = { 'workers': 8 };
64-
> {{alias}}( files, opts, done );
65-
6656
See Also
6757
--------
6858

parallel/docs/types/index.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ type Callback = Nullary | Unary;
9494
*
9595
* function done( error ) {
9696
* if ( error ) {
97-
* throw error;
97+
* console.log( error.message );
9898
* }
9999
* }
100100
*
@@ -127,7 +127,7 @@ declare function parallel( files: Array<string>, clbk: Callback ): void;
127127
*
128128
* function done( error ) {
129129
* if ( error ) {
130-
* throw error;
130+
* console.log( error.message );
131131
* }
132132
* }
133133
*

parallel/examples/index.js

Lines changed: 33 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ var writeFileSync = require( '@stdlib/fs/write-file' ).sync;
2626
var unlinkSync = require( '@stdlib/fs/unlink' ).sync;
2727
var parallel = require( './../lib' );
2828

29-
var nFiles = 100;
30-
var files;
31-
var opts;
32-
var dir;
33-
3429
/**
3530
* Returns a generated script.
3631
*
@@ -84,33 +79,35 @@ function createScripts( dir, nFiles ) {
8479
var files;
8580
var i;
8681

87-
files = new Array( nFiles );
82+
files = [];
8883
for ( i = 0; i < nFiles; i++ ) {
8984
content = template( i.toString() );
9085
fpath = path.join( dir, i+'.js' );
9186
writeFileSync( fpath, content, {
9287
'encoding': 'utf8'
9388
});
94-
files[ i ] = fpath;
89+
files.push( fpath );
9590
}
9691
return files;
9792
}
9893

99-
/**
100-
* Performs clean-up tasks once all scripts have run.
101-
*
102-
* @private
103-
*/
104-
function cleanup() {
105-
var i;
94+
var nFiles = 10;
10695

107-
// Delete the temporary files...
108-
for ( i = 0; i < files.length; i++ ) {
109-
unlinkSync( files[ i ] );
110-
}
111-
// Remove temporary directory:
112-
fs.rmdirSync( dir );
113-
}
96+
// Make a temporary directory to store files:
97+
var dir = createDir();
98+
99+
// Create temporary files:
100+
var files = createScripts( dir, nFiles );
101+
102+
// Set the runner options:
103+
var opts = {
104+
'concurrency': 3,
105+
'workers': 3,
106+
'ordered': false
107+
};
108+
109+
// Run all temporary scripts:
110+
parallel( files, opts, done );
114111

115112
/**
116113
* Callback invoked once all scripts finish.
@@ -120,24 +117,24 @@ function cleanup() {
120117
*/
121118
function done( error ) {
122119
if ( error ) {
123-
throw error;
120+
console.log( error.message );
124121
}
125122
cleanup();
126123
console.log( 'Done!' );
127124
}
128125

129-
// Make a temporary directory to store files...
130-
dir = createDir();
131-
132-
// Create temporary files...
133-
files = createScripts( dir, nFiles );
134-
135-
// Set the runner options:
136-
opts = {
137-
'concurrency': 3,
138-
'workers': 3,
139-
'ordered': false
140-
};
126+
/**
127+
* Performs clean-up tasks once all scripts have run.
128+
*
129+
* @private
130+
*/
131+
function cleanup() {
132+
var i;
141133

142-
// Run all temporary scripts:
143-
parallel( files, opts, done );
134+
// Delete the temporary files...
135+
for ( i = 0; i < files.length; i++ ) {
136+
unlinkSync( files[ i ] );
137+
}
138+
// Remove temporary directory:
139+
fs.rmdirSync( dir );
140+
}

parallel/examples/serial.js

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* limitations under the License.
1717
*/
1818

19-
/* eslint-disable node/no-sync */
19+
/* eslint-disable node/no-sync, stdlib/no-dynamic-require, stdlib/no-unassigned-require, stdlib/require-last-path-relative */
2020

2121
'use strict';
2222

@@ -25,11 +25,6 @@ var path = require( 'path' );
2525
var writeFileSync = require( '@stdlib/fs/write-file' ).sync;
2626
var unlinkSync = require( '@stdlib/fs/unlink' ).sync;
2727

28-
var nFiles = 100;
29-
var files;
30-
var dir;
31-
var i;
32-
3328
/**
3429
* Returns a generated script.
3530
*
@@ -83,18 +78,35 @@ function createScripts( dir, nFiles ) {
8378
var files;
8479
var i;
8580

86-
files = new Array( nFiles );
81+
files = [];
8782
for ( i = 0; i < nFiles; i++ ) {
8883
content = template( i.toString() );
8984
fpath = path.join( dir, i+'.js' );
9085
writeFileSync( fpath, content, {
9186
'encoding': 'utf8'
9287
});
93-
files[ i ] = fpath;
88+
files.push( fpath );
9489
}
9590
return files;
9691
}
9792

93+
var nFiles = 10;
94+
95+
// Make a temporary directory to store files:
96+
var dir = createDir();
97+
98+
// Create temporary files:
99+
var files = createScripts( dir, nFiles );
100+
101+
// Run all scripts sequentially...
102+
var i;
103+
for ( i = 0; i < nFiles; i++ ) {
104+
require( files[ i ] );
105+
}
106+
107+
cleanup();
108+
console.log( 'Done!' );
109+
98110
/**
99111
* Performs clean-up tasks once all scripts have run.
100112
*
@@ -110,17 +122,3 @@ function cleanup() {
110122
// Remove temporary directory:
111123
fs.rmdirSync( dir );
112124
}
113-
114-
// Make a temporary directory to store files...
115-
dir = createDir();
116-
117-
// Create temporary files...
118-
files = createScripts( dir, nFiles );
119-
120-
// Run all scripts sequentially...
121-
for ( i = 0; i < nFiles; i++ ) {
122-
require( files[ i ] ); // eslint-disable-line stdlib/no-dynamic-require, stdlib/no-unassigned-require
123-
}
124-
125-
cleanup();
126-
console.log( 'Done!' );

parallel/lib/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@
2828
*
2929
* function done( error ) {
3030
* if ( error ) {
31-
* throw error;
31+
* console.log( error.message );
3232
* }
3333
* }
34+
*
3435
* var files = [ './a.js', './b.js' ];
3536
* parallel( files, done );
3637
*/

parallel/lib/main.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
// MODULES //
2222

23-
var path = require( 'path' );
23+
var resolve = require( 'path' ).resolve;
2424
var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives;
2525
var isFunction = require( '@stdlib/assert/is-function' );
2626
var format = require( '@stdlib/string/format' );
@@ -60,7 +60,7 @@ var exec = require( './node' );
6060
*
6161
* function done( error ) {
6262
* if ( error ) {
63-
* throw error;
63+
* console.log( error.message );
6464
* }
6565
* }
6666
*
@@ -105,7 +105,7 @@ function parallel() {
105105
// Resolve any relative paths to absolute paths...
106106
dir = cwd();
107107
for ( i = 0; i < files.length; i++ ) {
108-
files[ i ] = path.resolve( dir, files[ i ] );
108+
files[ i ] = resolve( dir, files[ i ] );
109109
}
110110
exec( files, opts, done );
111111

0 commit comments

Comments
 (0)