Skip to content

Commit 8adce00

Browse files
committed
chore: fix JavaScript lint errors
Propagates fix from 650bf8a ("chore: fix JavaScript lint errors") to sibling example files that still build error messages via string concatenation. Replaces `new Error( 'text: ' + value )` with `new Error( format( 'text: %s', value ) )` and adds the `@stdlib/string/format` import across `utils/async/inmap`, `utils/async/inmap-right`, `utils/async/for-each`, and `datasets/us-states-capitals-names` examples.
1 parent 81a545e commit 8adce00

File tree

4 files changed

+8
-4
lines changed
  • lib/node_modules/@stdlib

4 files changed

+8
-4
lines changed

lib/node_modules/@stdlib/datasets/us-states-capitals-names/examples/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
'use strict';
2020

2121
var capitalize = require( '@stdlib/string/capitalize' );
22+
var format = require( '@stdlib/string/format' );
2223
var table = require( './../lib' );
2324

2425
var tbl = table();
@@ -38,7 +39,7 @@ function getState( capital ) {
3839

3940
// Ensure a valid capital name was provided...
4041
if ( state === void 0 ) {
41-
throw new Error( 'unrecognized capital. Value: `' + capital + '`.' );
42+
throw new Error( format( 'unrecognized capital. Value: `%s`.', capital ) );
4243
}
4344
return state;
4445
}

lib/node_modules/@stdlib/utils/async/for-each/examples/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
var resolve = require( 'path' ).resolve;
2222
var readFile = require( '@stdlib/fs/read-file' );
23+
var format = require( '@stdlib/string/format' );
2324
var forEachAsync = require( './../lib' );
2425

2526
var files = [
@@ -42,7 +43,7 @@ function read( file, next ) {
4243

4344
function onFile( error ) {
4445
if ( error ) {
45-
error = new Error( 'unable to read file: '+file );
46+
error = new Error( format( 'unable to read file: %s', file ) );
4647
return next( error );
4748
}
4849
console.log( 'Successfully read file: %s', file );

lib/node_modules/@stdlib/utils/async/inmap-right/examples/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
var resolve = require( 'path' ).resolve;
2222
var readFile = require( '@stdlib/fs/read-file' );
23+
var format = require( '@stdlib/string/format' );
2324
var inmapRightAsync = require( './../lib' );
2425

2526
var files = [
@@ -42,7 +43,7 @@ function read( file, next ) {
4243

4344
function onFile( error, data ) {
4445
if ( error ) {
45-
error = new Error( 'unable to read file: '+file );
46+
error = new Error( format( 'unable to read file: %s', file ) );
4647
return next( error );
4748
}
4849
next( null, data );

lib/node_modules/@stdlib/utils/async/inmap/examples/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
var resolve = require( 'path' ).resolve;
2222
var readFile = require( '@stdlib/fs/read-file' );
23+
var format = require( '@stdlib/string/format' );
2324
var inmapAsync = require( './../lib' );
2425

2526
var files = [
@@ -42,7 +43,7 @@ function read( file, next ) {
4243

4344
function onFile( error, data ) {
4445
if ( error ) {
45-
error = new Error( 'unable to read file: '+file );
46+
error = new Error( format( 'unable to read file: %s', file ) );
4647
return next( error );
4748
}
4849
next( null, data );

0 commit comments

Comments
 (0)