Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
var resolve = require( 'path' ).resolve;
var writeFileSync = require( '@stdlib/fs/write-file' ).sync;
var readFileSync = require( '@stdlib/fs/read-file' ).sync;
var format = require( '@stdlib/string/format' );
var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP;


Expand All @@ -49,7 +50,7 @@
opts = {
'encoding': 'utf8'
};
file = readFileSync( fpath, opts );

Check warning on line 53 in lib/node_modules/@stdlib/datasets/berndt-cps-wages-1985/scripts/build_json.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected sync method: 'readFileSync'
if ( file instanceof Error ) {
throw file;
}
Expand All @@ -66,7 +67,7 @@
} else {
tmp = file[ i ].split( ',' );
if ( tmp.length !== headers.length ) {
throw new Error( 'number of columns does not match number of columns for row '+i+'.' );
throw new Error( format( 'number of columns does not match number of columns for row %d.', i ) );
}
row = {};
for ( j = 0; j < headers.length; j++ ) {
Expand All @@ -91,7 +92,7 @@

// Write the JSON file:
fpath = resolve( __dirname, '..', 'data', 'data.json' );
writeFileSync( fpath, JSON.stringify( file )+'\n', opts );

Check warning on line 95 in lib/node_modules/@stdlib/datasets/berndt-cps-wages-1985/scripts/build_json.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected sync method: 'writeFileSync'
}

main();
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
var resolve = require( 'path' ).resolve;
var readFile = require( '@stdlib/fs/read-file' ).sync;
var writeFile = require( '@stdlib/fs/write-file' ).sync;
var format = require( '@stdlib/string/format' );
var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP;


Expand Down Expand Up @@ -67,7 +68,7 @@ function main() {
for ( i = 0; i < data.length; i++ ) {
d = data[ i ].split( ',' );
if ( d.length !== fields.length ) {
throw new Error( 'unexpected error. Number of row values ('+d.length+') does not match the expected number of fields ('+fields.length+').' );
throw new Error( format( 'unexpected error. Number of row values (%d) does not match the expected number of fields (%d).', d.length, fields.length ) );
}
for ( j = 0; j < d.length; j++ ) {
d[ j ] = parseFloat( d[ j ] );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
var resolve = require( 'path' ).resolve;
var readFile = require( '@stdlib/fs/read-file' ).sync;
var writeFile = require( '@stdlib/fs/write-file' ).sync;
var format = require( '@stdlib/string/format' );
var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP;


Expand Down Expand Up @@ -67,7 +68,7 @@ function main() {
for ( i = 0; i < data.length; i++ ) {
d = data[ i ].split( ',' );
if ( d.length !== fields.length ) {
throw new Error( 'unexpected error. Number of row values ('+d.length+') does not match the expected number of fields ('+fields.length+').' );
throw new Error( format( 'unexpected error. Number of row values (%d) does not match the expected number of fields (%d).', d.length, fields.length ) );
}
for ( j = 0; j < d.length; j++ ) {
d[ j ] = parseFloat( d[ j ] );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

var resolve = require( 'path' ).resolve;
var writeFile = require( '@stdlib/fs/write-file' ).sync;
var format = require( '@stdlib/string/format' );
var dataset = require( '@stdlib/datasets/emoji' );


Expand Down Expand Up @@ -63,7 +64,7 @@ function main() {
for ( j = 0; j < codes.length; j++ ) {
c = codes[ j ];
if ( json[ c ] ) {
throw new Error( 'unexpected error. Duplicate emoji code: `' + c + '`.' );
throw new Error( format( 'unexpected error. Duplicate emoji code: `%s`.', c ) );
}
json[ c ] = d.emoji;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
var resolve = require( 'path' ).resolve;
var readFile = require( '@stdlib/fs/read-file' ).sync;
var writeFile = require( '@stdlib/fs/write-file' ).sync;
var format = require( '@stdlib/string/format' );
var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP;
var meta = require( './../datapackage.json' );

Expand Down Expand Up @@ -78,7 +79,7 @@ function main() {
for ( i = 0; i < data.length; i++ ) {
d = data[ i ];
if ( d.length !== fields.length ) {
throw new Error( 'unexpected error. Number of expected fields ('+fields.length+') does not match number of data fields ('+d.length+').' );
throw new Error( format( 'unexpected error. Number of expected fields (%d) does not match number of data fields (%d).', fields.length, d.length ) );
}
tmp = {};
for ( j = 0; j < fields.length; j++ ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
var resolve = require( 'path' ).resolve;
var writeFileSync = require( '@stdlib/fs/write-file' ).sync;
var readFileSync = require( '@stdlib/fs/read-file' ).sync;
var format = require( '@stdlib/string/format' );
var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP;


Expand All @@ -49,7 +50,7 @@
opts = {
'encoding': 'utf8'
};
file = readFileSync( fpath, opts );

Check warning on line 53 in lib/node_modules/@stdlib/datasets/frb-sf-wage-rigidity/scripts/build_json.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected sync method: 'readFileSync'
if ( file instanceof Error ) {
throw file;
}
Expand All @@ -66,7 +67,7 @@
} else {
tmp = file[ i ].split( ',' );
if ( tmp.length !== headers.length ) {
throw new Error( 'number of columns does not match number of columns for row '+i+'.' );
throw new Error( format( 'number of columns does not match number of columns for row %d.', i ) );
}
row = {};
for ( j = 0; j < headers.length; j++ ) {
Expand All @@ -86,7 +87,7 @@

// Write the JSON file:
fpath = resolve( __dirname, '..', 'data', 'data.json' );
writeFileSync( fpath, JSON.stringify( file )+'\n', opts );

Check warning on line 90 in lib/node_modules/@stdlib/datasets/frb-sf-wage-rigidity/scripts/build_json.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected sync method: 'writeFileSync'
}

main();
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
var resolve = require( 'path' ).resolve;
var readFileSync = require( '@stdlib/fs/read-file' ).sync;
var writeFileSync = require( '@stdlib/fs/write-file' ).sync;
var format = require( '@stdlib/string/format' );
var replace = require( '@stdlib/string/replace' );
var FILE_LIST = require( './../data/file_list.json' );

Expand Down Expand Up @@ -60,7 +61,7 @@
for ( i = 0; i < FILE_LIST.length; i++ ) {
f = FILE_LIST[ i ];
fpath = resolve( __dirname, '..', 'data', f );
file = readFileSync( fpath, opts );

Check warning on line 64 in lib/node_modules/@stdlib/datasets/moby-dick/scripts/to_json.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected sync method: 'readFileSync'
out = {};
if ( f === 'contents.txt' ) {
out.chapter = 'Contents';
Expand All @@ -68,28 +69,28 @@
} else if ( f === 'epilogue.txt' ) {
tmp = RE_TITLE.exec( file );
if ( !tmp ) {
throw new Error( 'Unexpected file content for file '+f+'.' );
throw new Error( format( 'Unexpected file content for file %s.', f ) );
}
out.chapter = 'Epilogue';
out.title = tmp[ 1 ];
} else if ( f === 'etymology.txt' ) {
tmp = RE_TITLE.exec( file );
if ( !tmp ) {
throw new Error( 'Unexpected file content for file '+f+'.' );
throw new Error( format( 'Unexpected file content for file %s.', f ) );
}
out.chapter = 'Etymology';
out.title = tmp[ 1 ];
} else if ( f === 'extracts.txt' ) {
tmp = RE_TITLE.exec( file );
if ( !tmp ) {
throw new Error( 'Unexpected file content for file '+f+'.' );
throw new Error( format( 'Unexpected file content for file %s.', f ) );
}
out.chapter = 'Extracts';
out.title = tmp[ 1 ];
} else {
tmp = RE_CHAPTER_TITLE.exec( file );
if ( !tmp ) {
throw new Error( 'Unexpected file content for file '+f+'.' );
throw new Error( format( 'Unexpected file content for file %s.', f ) );
}
out.chapter = tmp[ 1 ];
out.title = tmp[ 2 ];
Expand All @@ -97,7 +98,7 @@
}
out.text = file;
fpath = replace( fpath, '.txt', '.json' );
writeFileSync( fpath, JSON.stringify( out ), opts );

Check warning on line 101 in lib/node_modules/@stdlib/datasets/moby-dick/scripts/to_json.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected sync method: 'writeFileSync'
}
}

Expand Down