Skip to content

Commit e71ee20

Browse files
committed
docs: update js examples to use logEach
--- 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: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - 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 3381626 commit e71ee20

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

lib/node_modules/@stdlib/number/uint32/base/identity/README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,20 +83,18 @@ v = identity( 4294967295 );
8383

8484
```javascript
8585
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
86+
var logEachMap = require( '@stdlib/console/log-each-map' );
8687
var identity = require( '@stdlib/number/uint32/base/identity' );
8788

8889
var opts = {
8990
'dtype': 'uint32'
9091
};
9192

93+
// Create an array of random values:
9294
var x = discreteUniform( 100, 0, 50, opts );
9395

94-
var v;
95-
var i;
96-
for ( i = 0; i < x.length; i++ ) {
97-
v = identity( x[ i ] );
98-
console.log( 'identity(%d) = %d', x[ i ], v );
99-
}
96+
// Perform element-wise operation:
97+
logEachMap( 'identity(%d) = %d', x, identity );
10098
```
10199

102100
</section>

lib/node_modules/@stdlib/number/uint32/base/identity/examples/index.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,15 @@
1919
'use strict';
2020

2121
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
22+
var logEachMap = require( '@stdlib/console/log-each-map' );
2223
var identity = require( './../lib' );
2324

2425
var opts = {
2526
'dtype': 'uint32'
2627
};
2728

29+
// Create an array of random values:
2830
var x = discreteUniform( 100, 0, 50, opts );
2931

30-
var v;
31-
var i;
32-
for ( i = 0; i < x.length; i++ ) {
33-
v = identity( x[ i ] );
34-
console.log( 'identity(%d) = %d', x[ i ], v );
35-
}
32+
// Perform element-wise operation:
33+
logEachMap( 'identity(%d) = %d', x, identity );

0 commit comments

Comments
 (0)