Skip to content

Commit 325ec43

Browse files
committed
docs: add string and float examples
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 736e165 commit 325ec43

File tree

4 files changed

+55
-3
lines changed

4 files changed

+55
-3
lines changed

lib/node_modules/@stdlib/console/log-each-map/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ function multiply( x, y ) {
9595
}
9696

9797
var x = [ 1, 2, 3 ];
98-
var y = 2;
98+
var y = 0.5;
9999

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

104104
The callback function is provided the following arguments:

lib/node_modules/@stdlib/console/log-each-map/docs/repl.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,15 @@
2727
> function f( x, y ) { return x + y; };
2828
> {{alias}}( '%d + %d = %d', x, y, f );
2929

30+
> var x = [ 0.5, 1.0, 1.5 ];
31+
> var y = [ 0.5, 0.75, 1.0 ];
32+
> function f( x, y ) { return x * y; };
33+
> {{alias}}( '%0.2f * %0.2f = %0.2f', x, y, f );
34+
35+
> var x = [ 'foo', 'bar' ];
36+
> var y = [ 'baz', 'beep' ];
37+
> function f( x, y ) { return x + y; };
38+
> {{alias}}( '%s-%s', x, y, f );
39+
3040
See Also
3141
--------

lib/node_modules/@stdlib/console/log-each-map/lib/index.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,26 @@
3535
*
3636
* logEachMap( '%d + %d = %d', x, y, add );
3737
* // e.g., => '1 + 4 = 5\n2 + 5 = 7\n3 + 6 = 9\n'
38+
*
39+
* function multiply( x, y ) {
40+
* return x * y;
41+
* }
42+
*
43+
* var x = [ 0.5, 1.0, 1.5 ];
44+
* var y = [ 0.5, 0.75, 1.0 ];
45+
*
46+
* logEachMap( '%0.2f * %0.2f = %0.2f', x, y, multiply );
47+
* // e.g., => '0.50 * 0.50 = 0.25\n1.00 * 0.75 = 0.75\n1.50 * 1.00 = 1.50\n'
48+
*
49+
* function append( x, y ) {
50+
* return x + y;
51+
* }
52+
*
53+
* var x = [ 'foo', 'bar' ];
54+
* var y = [ 'baz', 'beep' ];
55+
*
56+
* logEachMap( '%s-%s', x, y, append );
57+
* // e.g., => 'foo-baz\nbar-beep\n'
3858
*/
3959

4060
// MODULES //

lib/node_modules/@stdlib/console/log-each-map/lib/main.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,28 @@ var logger = require( '@stdlib/console/log' );
5454
*
5555
* logEachMap( '%d + %d = %d', x, y, add );
5656
* // e.g., => '1 + 4 = 5\n2 + 5 = 7\n3 + 6 = 9\n'
57+
*
58+
* @example
59+
* function multiply( x, y ) {
60+
* return x * y;
61+
* }
62+
*
63+
* var x = [ 0.5, 1.0, 1.5 ];
64+
* var y = [ 0.5, 0.75, 1.0 ];
65+
*
66+
* logEachMap( '%0.2f * %0.2f = %0.2f', x, y, multiply );
67+
* // e.g., => '0.50 * 0.50 = 0.25\n1.00 * 0.75 = 0.75\n1.50 * 1.00 = 1.50\n'
68+
*
69+
* @example
70+
* function append( x, y ) {
71+
* return x + y;
72+
* }
73+
*
74+
* var x = [ 'foo', 'bar' ];
75+
* var y = [ 'baz', 'beep' ];
76+
*
77+
* logEachMap( '%s-%s', x, y, append );
78+
* // e.g., => 'foo-baz\nbar-beep\n'
5779
*/
5880
function logEachMap( str ) {
5981
var strides;

0 commit comments

Comments
 (0)