Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Dec 31, 2024
1 parent ea5a883 commit ae29319
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<section class="release" id="unreleased">

## Unreleased (2024-12-30)
## Unreleased (2024-12-31)

<section class="packages">

Expand Down Expand Up @@ -180,6 +180,7 @@ A total of 4 people contributed to this release. Thank you to the following cont

<details>

- [`8d7f8e2`](https://github.com/stdlib-js/stdlib/commit/8d7f8e26975ffa5ca2ff11a24eac5f3bba589104) - **refactor:** add specialized handling for displaying ndarrays _(by Athan Reines)_
- [`109c303`](https://github.com/stdlib-js/stdlib/commit/109c3034461f70d36339206cf05237230aba0902) - **docs:** update REPL namespace documentation [(#4364)](https://github.com/stdlib-js/stdlib/pull/4364) _(by stdlib-bot)_
- [`7d8aba0`](https://github.com/stdlib-js/stdlib/commit/7d8aba04d7513814f09d725b81c0f953ad4c3b7f) - **feat:** add ndarray APIs and float32 constants to namespace _(by Athan Reines)_
- [`800e80b`](https://github.com/stdlib-js/stdlib/commit/800e80b8550012d379d57c8ac7e14909a96cbc60) - **docs:** update REPL namespace documentation [(#4336)](https://github.com/stdlib-js/stdlib/pull/4336) _(by stdlib-bot, Philipp Burckhardt)_
Expand Down
9 changes: 8 additions & 1 deletion lib/drain.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

var inspect = require( 'util' ).inspect;
var logger = require( 'debug' );
var isndarrayLike = require( '@stdlib/assert/is-ndarray-like' );
var replace = require( '@stdlib/string/replace' );
var noop = require( '@stdlib/utils/noop' );
var nextTick = require( '@stdlib/utils/next-tick' );
Expand Down Expand Up @@ -53,6 +54,7 @@ function drain( repl ) {
var code;
var res;
var pre;
var tmp;

if ( repl._busy ) {
debug( 'Waiting on a command to finish...' );
Expand Down Expand Up @@ -127,7 +129,12 @@ function drain( repl ) {
pre = replace( repl._outputPrompt, '%d', (repl._count+1).toString() );

// TODO: pretty printing (can defer to `util.inspect` for now, but will invariably want more control over this later, possibly including default configuration, etc, either at startup, during runtime, or according to an external configuration file)
repl._ostream.write( pre+inspect( repl._ans )+'\n' );
if ( isndarrayLike( res ) ) {
tmp = res.toString(); // FIXME: this is a hack in order to avoid printing private ndarray properties in the REPL, as done by the built-in `util.inspect`. Ideally, we'd roll our own inspector which specifically accommodates stdlib's ndarray and other specialized classes.
} else {
tmp = repl._ans;
}
repl._ostream.write( pre+inspect( tmp )+'\n' );
}
// Finish processing:
return beforeNextTick();
Expand Down

0 comments on commit ae29319

Please sign in to comment.