From bc4ef6d50bcb0e151da91718e6a9700de654e9f1 Mon Sep 17 00:00:00 2001 From: Patel Prince <151719092+prince-patel23@users.noreply.github.com> Date: Sat, 9 Mar 2024 14:20:20 +0530 Subject: [PATCH] feat: Improve example in index.js for constants/uint8 namespace This commit enhances the example code in index.js within the @stdlib/constants/uint8/examples directory. The updated code now showcases the available uint8 constants by listing their names in the console output. This update aligns with RFC #1565, which aims to improve the README examples of the constants/uint8 namespace package. By enhancing the example code in index.js, users can better understand how to access and utilize the uint8 constants provided by the package. The revised code imports the constants module from @stdlib/constants/uint8, extracts the names of the available constants using Object.keys(), and then prints out these names to the console. This provides a more informative output that demonstrates the functionality of the constants/uint8 namespace. Signed-off-by: Patel Prince <151719092+prince-patel23@users.noreply.github.com> --- .../@stdlib/constants/uint8/examples/index.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/constants/uint8/examples/index.js b/lib/node_modules/@stdlib/constants/uint8/examples/index.js index f89ba7cacdef..6fbe162f7a18 100644 --- a/lib/node_modules/@stdlib/constants/uint8/examples/index.js +++ b/lib/node_modules/@stdlib/constants/uint8/examples/index.js @@ -18,7 +18,12 @@ 'use strict'; -var objectKeys = require( '@stdlib/utils/keys' ); -var constants = require( './../lib' ); +// Import the constants module +var constants = require( '@stdlib/constants/uint8' ); -console.log( objectKeys( constants ) ); +// Extract constant names from the module +var constantNames = Object.keys( constants ); + +// Print out the constant names +console.log( 'Available uint8 constants:' ); +console.log( constantNames.join( '\n' ) );