Skip to content

Commit 66c2a01

Browse files
committed
Use assertion utility
1 parent 77395e9 commit 66c2a01

File tree

1 file changed

+5
-3
lines changed
  • lib/node_modules/@stdlib/fs/read-json/lib

1 file changed

+5
-3
lines changed

lib/node_modules/@stdlib/fs/read-json/lib/sync.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ var isObject = require( '@stdlib/assert/is-plain-object' );
77
var readFile = require( '@stdlib/fs/read-file' ).sync;
88
var removeBOM = require( '@stdlib/string/remove-utf8-bom' );
99
var parseJSON = require( '@stdlib/utils/parse-json' );
10+
var instanceOf = require( '@stdlib/assert/instance-of' );
1011

1112

1213
// MAIN //
@@ -24,9 +25,10 @@ var parseJSON = require( '@stdlib/utils/parse-json' );
2425
*
2526
* @example
2627
* var resolve = require( 'path' ).resolve;
28+
* var instanceOf = require( '@stdlib/assert/instance-of' );
2729
*
28-
* var out = readJSONSync( resolve( __dirname, '../package.json' ) );
29-
* if ( out instanceof Error ) {
30+
* var out = readJSONSync( resolve( __dirname, '..', 'package.json' ) );
31+
* if ( instanceOf( out, Error ) ) {
3032
* throw out;
3133
* }
3234
* console.dir( out );
@@ -49,7 +51,7 @@ function readJSONSync( file, options ) {
4951
opts = {};
5052
}
5153
f = readFile( file, opts );
52-
if ( f instanceof Error ) {
54+
if ( instanceOf( f, Error ) ) {
5355
return f;
5456
}
5557
f = f.toString();

0 commit comments

Comments
 (0)