Skip to content

Commit e422e6a

Browse files
committed
chore: propagate format migration to README examples
Extends 8adce00 to the matching README example blocks. Athan Reines flagged that the `examples/index.js` fix needed to land in the READMEs too; updates `utils/async/inmap`, `utils/async/inmap-right`, `utils/async/for-each`, and `datasets/us-states-capitals-names` README examples to use `@stdlib/string/format` instead of string concatenation inside `new Error(...)`.
1 parent 8adce00 commit e422e6a

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

lib/node_modules/@stdlib/datasets/us-states-capitals-names/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ var t = table();
104104

105105
```javascript
106106
var capitalize = require( '@stdlib/string/capitalize' );
107+
var format = require( '@stdlib/string/format' );
107108
var table = require( '@stdlib/datasets/us-states-capitals-names' );
108109

109110
var tbl = table();
@@ -123,7 +124,7 @@ function getState( capital ) {
123124

124125
// Ensure a valid capital name was provided...
125126
if ( state === void 0 ) {
126-
throw new Error( 'unrecognized capital. Value: `' + capital + '`.' );
127+
throw new Error( format( 'unrecognized capital. Value: `%s`.', capital ) );
127128
}
128129
return state;
129130
}

lib/node_modules/@stdlib/utils/async/for-each/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ The function accepts the same `options` as `forEachAsync()`.
280280
```javascript
281281
var resolve = require( 'path' ).resolve;
282282
var readFile = require( '@stdlib/fs/read-file' );
283+
var format = require( '@stdlib/string/format' );
283284
var forEachAsync = require( '@stdlib/utils/async/for-each' );
284285

285286
var files = [
@@ -302,7 +303,7 @@ function read( file, next ) {
302303

303304
function onFile( error ) {
304305
if ( error ) {
305-
error = new Error( 'unable to read file: '+file );
306+
error = new Error( format( 'unable to read file: %s', file ) );
306307
return next( error );
307308
}
308309
console.log( 'Successfully read file: %s', file );

lib/node_modules/@stdlib/utils/async/inmap-right/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ The function accepts the same `options` as `inmapRightAsync()`.
366366
```javascript
367367
var resolve = require( 'path' ).resolve;
368368
var readFile = require( '@stdlib/fs/read-file' );
369+
var format = require( '@stdlib/string/format' );
369370
var inmapRightAsync = require( '@stdlib/utils/async/inmap-right' );
370371

371372
var files = [
@@ -388,7 +389,7 @@ function read( file, next ) {
388389

389390
function onFile( error, data ) {
390391
if ( error ) {
391-
error = new Error( 'unable to read file: '+file );
392+
error = new Error( format( 'unable to read file: %s', file ) );
392393
return next( error );
393394
}
394395
next( null, data );

lib/node_modules/@stdlib/utils/async/inmap/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ The function accepts the same `options` as `inmapAsync()`.
367367
```javascript
368368
var resolve = require( 'path' ).resolve;
369369
var readFile = require( '@stdlib/fs/read-file' );
370+
var format = require( '@stdlib/string/format' );
370371
var inmapAsync = require( '@stdlib/utils/async/inmap' );
371372

372373
var files = [
@@ -389,7 +390,7 @@ function read( file, next ) {
389390

390391
function onFile( error, data ) {
391392
if ( error ) {
392-
error = new Error( 'unable to read file: '+file );
393+
error = new Error( format( 'unable to read file: %s', file ) );
393394
return next( error );
394395
}
395396
next( null, data );

0 commit comments

Comments
 (0)