diff --git a/lib/node_modules/@stdlib/_tools/repl-txt/rules/doctest/lib/main.js b/lib/node_modules/@stdlib/_tools/repl-txt/rules/doctest/lib/main.js index 6bff7e991427..d1af26399e07 100644 --- a/lib/node_modules/@stdlib/_tools/repl-txt/rules/doctest/lib/main.js +++ b/lib/node_modules/@stdlib/_tools/repl-txt/rules/doctest/lib/main.js @@ -165,7 +165,7 @@ function main( context ) { return format( 'require(\'%s\')', pkg ); } // If an alias does not exist in the global namespace, dynamically `require` a package so that the desired expression can be executed: - return format( 'require(\'%s\')', pkg ); + return format( '(require(\'%s\'))', pkg ); } alias = alias.split( '.' ); len = alias.length; diff --git a/lib/node_modules/@stdlib/repl/help/scripts/build.js b/lib/node_modules/@stdlib/repl/help/scripts/build.js index 59bf5460c6ae..88c330d14e92 100644 --- a/lib/node_modules/@stdlib/repl/help/scripts/build.js +++ b/lib/node_modules/@stdlib/repl/help/scripts/build.js @@ -184,7 +184,7 @@ function main() { continue; } // If an alias does not exist in the global namespace, dynamically `require` a package so that the desired expression can be executed in example code: - file = replace( file, tmp[ j ], format( 'require(\'%s\')', p ) ); // WARNING: this assumes that `{{alias:}}` placeholders are in examples. If unresolved package identifiers are used in descriptions, this substitution is NOT appropriate. The use of such placeholders in description prose is uncommon, but not unheard of. However, given its relatively rare occurrence, we can likely be confident that this substitution is okay. Ideally, identifiers would be added to the database, so that this workaround is not necessary. + file = replace( file, tmp[ j ], format( '(require(\'%s\'))', p ) ); // WARNING: this assumes that `{{alias:}}` placeholders are in examples. If unresolved package identifiers are used in descriptions, this substitution is NOT appropriate. The use of such placeholders in description prose is uncommon, but not unheard of. However, given its relatively rare occurrence, we can likely be confident that this substitution is okay. Ideally, identifiers would be added to the database, so that this workaround is not necessary. debug( 'Inserted a `require` expression for `%s`.', p ); } else { file = replace( file, tmp[ j ], a );