Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 3 additions & 3 deletions lib/node_modules/@stdlib/console/log-each-map/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ function multiply( x, y ) {
}

var x = [ 1, 2, 3 ];
var y = 2;
var y = 0.5;

logEachMap( '%d * %d = %d', x, y, multiply );
// e.g., => '1 * 2 = 2\n2 * 2 = 4\n3 * 2 = 6\n'
logEachMap( '%0.1f * %0.1f = %0.1f', x, y, multiply );
// e.g., => '1.0 * 0.5 = 0.5\n2.0 * 0.5 = 1.0\n3.0 * 0.5 = 1.5\n'
```

The callback function is provided the following arguments:
Expand Down
10 changes: 10 additions & 0 deletions lib/node_modules/@stdlib/console/log-each-map/docs/repl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,15 @@
> function f( x, y ) { return x + y; };
> {{alias}}( '%d + %d = %d', x, y, f );

> var x = [ 0.5, 1.0, 1.5 ];
> var y = [ 0.5, 0.75, 1.0 ];
> function f( x, y ) { return x * y; };
> {{alias}}( '%0.2f * %0.2f = %0.2f', x, y, f );

> var x = [ 'foo', 'bar' ];
> var y = [ 'baz', 'beep' ];
> function f( x, y ) { return x + y; };
> {{alias}}( '%s-%s', x, y, f );

See Also
--------
20 changes: 20 additions & 0 deletions lib/node_modules/@stdlib/console/log-each-map/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,26 @@
*
* logEachMap( '%d + %d = %d', x, y, add );
* // e.g., => '1 + 4 = 5\n2 + 5 = 7\n3 + 6 = 9\n'
*
* function multiply( x, y ) {
* return x * y;
* }
*
* var x = [ 0.5, 1.0, 1.5 ];
* var y = [ 0.5, 0.75, 1.0 ];
*
* logEachMap( '%0.2f * %0.2f = %0.2f', x, y, multiply );
* // e.g., => '0.50 * 0.50 = 0.25\n1.00 * 0.75 = 0.75\n1.50 * 1.00 = 1.50\n'
*
* function append( x, y ) {
* return x + y;
* }
*
* var x = [ 'foo', 'bar' ];
* var y = [ 'baz', 'beep' ];
*
* logEachMap( '%s-%s', x, y, append );
* // e.g., => 'foo-baz\nbar-beep\n'
*/

// MODULES //
Expand Down
22 changes: 22 additions & 0 deletions lib/node_modules/@stdlib/console/log-each-map/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,28 @@ var logger = require( '@stdlib/console/log' );
*
* logEachMap( '%d + %d = %d', x, y, add );
* // e.g., => '1 + 4 = 5\n2 + 5 = 7\n3 + 6 = 9\n'
*
* @example
* function multiply( x, y ) {
* return x * y;
* }
*
* var x = [ 0.5, 1.0, 1.5 ];
* var y = [ 0.5, 0.75, 1.0 ];
*
* logEachMap( '%0.2f * %0.2f = %0.2f', x, y, multiply );
* // e.g., => '0.50 * 0.50 = 0.25\n1.00 * 0.75 = 0.75\n1.50 * 1.00 = 1.50\n'
*
* @example
* function append( x, y ) {
* return x + y;
* }
*
* var x = [ 'foo', 'bar' ];
* var y = [ 'baz', 'beep' ];
*
* logEachMap( '%s-%s', x, y, append );
* // e.g., => 'foo-baz\nbar-beep\n'
*/
function logEachMap( str ) {
var strides;
Expand Down