Skip to content

Commit 7464f4a

Browse files
committed
Change arguments check and add explanatory note
1 parent d4bce04 commit 7464f4a

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

tools/remark/plugins/remark-html-equation-src-urls/lib/attacher.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ var defaults = require( './defaults.json' );
2323
*/
2424
function attacher( remark, options ) {
2525
var opts = copy( defaults );
26-
if ( arguments.length > 1 ) {
26+
27+
// NOTE: cannot use `arguments.length` check, as `options` may be explicitly passed as `undefined`
28+
if ( options !== void 0 ) {
2729
if ( !isObject( options ) ) {
2830
throw new TypeError( 'invalid input argument. Options argument must be an object. Value: `' + options + '`.' );
2931
}

tools/remark/plugins/remark-svg-equations/lib/attacher.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ var defaults = require( './defaults.json' );
2323
*/
2424
function attacher( remark, options ) {
2525
var opts = copy( defaults );
26-
if ( options !== undefined ) {
26+
27+
// NOTE: cannot use `arguments.length` check, as `options` may be explicitly passed as `undefined`
28+
if ( options !== void 0 ) {
2729
if ( !isObject( options ) ) {
2830
throw new TypeError( 'invalid input argument. Options argument must be an object. Value: `' + options + '`.' );
2931
}

0 commit comments

Comments
 (0)