From 18217986ea9f42ec7e2e12830b0b1dc5bd29a8d3 Mon Sep 17 00:00:00 2001 From: Patel Prince <151719092+prince-patel23@users.noreply.github.com> Date: Mon, 11 Mar 2024 22:09:10 +0530 Subject: [PATCH] Improve README examples for math/iter/special namespace The README file serves as a crucial entry point for users exploring a package. Hence, it's essential to provide clear and informative examples that demonstrate the package's functionality effectively. Prior to this commit, the README examples for the math/iter/special namespace were minimal and did not adequately showcase the available functionality. To address this, I have updated the README examples to include a more detailed demonstration of the `iterSqrt` function, which is one of the key functions within the namespace. This function iteratively computes the square root of each value in an array, making it a useful tool for certain mathematical applications. Additionally, I have included comments within the example code to provide further clarity on the functionality being demonstrated. These comments help guide users through the example and explain the purpose of each step. By improving the README examples in this manner, we aim to provide users with a better understanding of the capabilities offered by the math/iter/special namespace. This should ultimately enhance the overall user experience and make it easier for users to leverage the functionality provided by the package. This commit closes RFC #1578. Signed-off-by: Patel Prince <151719092+prince-patel23@users.noreply.github.com> --- .../@stdlib/math/iter/special/examples/index.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/math/iter/special/examples/index.js b/lib/node_modules/@stdlib/math/iter/special/examples/index.js index b34f8f4522ad..1130c57c702b 100644 --- a/lib/node_modules/@stdlib/math/iter/special/examples/index.js +++ b/lib/node_modules/@stdlib/math/iter/special/examples/index.js @@ -21,4 +21,16 @@ var objectKeys = require( '@stdlib/utils/keys' ); var ns = require( './../lib' ); -console.log( objectKeys( ns ) ); +// Example showcasing the use of a function from the math/iter/special namespace +var iterSqrt = ns.iterSqrt; +var array = [1, 4, 9, 16]; +var it = iterSqrt( array ); + +var v; +while ( ( v = it.next().value ) ) { + console.log( v ); +} +// => 1 +// => 2 +// => 3 +// => 4