File tree Expand file tree Collapse file tree 4 files changed +8
-4
lines changed
datasets/us-states-capitals-names Expand file tree Collapse file tree 4 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,7 @@ var t = table();
104104
105105``` javascript
106106var capitalize = require ( ' @stdlib/string/capitalize' );
107+ var format = require ( ' @stdlib/string/format' );
107108var table = require ( ' @stdlib/datasets/us-states-capitals-names' );
108109
109110var 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}
Original file line number Diff line number Diff line change @@ -280,6 +280,7 @@ The function accepts the same `options` as `forEachAsync()`.
280280``` javascript
281281var resolve = require ( ' path' ).resolve ;
282282var readFile = require ( ' @stdlib/fs/read-file' );
283+ var format = require ( ' @stdlib/string/format' );
283284var forEachAsync = require ( ' @stdlib/utils/async/for-each' );
284285
285286var 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 );
Original file line number Diff line number Diff line change @@ -366,6 +366,7 @@ The function accepts the same `options` as `inmapRightAsync()`.
366366``` javascript
367367var resolve = require ( ' path' ).resolve ;
368368var readFile = require ( ' @stdlib/fs/read-file' );
369+ var format = require ( ' @stdlib/string/format' );
369370var inmapRightAsync = require ( ' @stdlib/utils/async/inmap-right' );
370371
371372var 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 );
Original file line number Diff line number Diff line change @@ -367,6 +367,7 @@ The function accepts the same `options` as `inmapAsync()`.
367367``` javascript
368368var resolve = require ( ' path' ).resolve ;
369369var readFile = require ( ' @stdlib/fs/read-file' );
370+ var format = require ( ' @stdlib/string/format' );
370371var inmapAsync = require ( ' @stdlib/utils/async/inmap' );
371372
372373var 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 );
You can’t perform that action at this time.
0 commit comments