From a33ca7e6eecaf3ca248e6c04c9364e6f85de400d Mon Sep 17 00:00:00 2001 From: Zuhair Date: Mon, 29 Sep 2025 11:15:12 +0530 Subject: [PATCH 1/7] linting bug fix --- .../@stdlib/utils/object-inverse-by/examples/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/utils/object-inverse-by/examples/index.js b/lib/node_modules/@stdlib/utils/object-inverse-by/examples/index.js index 1b4b40b2b0b3..dd8d6982e46e 100644 --- a/lib/node_modules/@stdlib/utils/object-inverse-by/examples/index.js +++ b/lib/node_modules/@stdlib/utils/object-inverse-by/examples/index.js @@ -33,7 +33,7 @@ function transform( key, value ) { } // Create an array of random integers... -arr = new Array( 1000 ); +const arr = Array.from({ length: 1000 }); for ( i = 0; i < arr.length; i++ ) { arr[ i ] = round( randu()*100.0 ); } From 50068d4b92c86089851f1b53fc808789f607e020 Mon Sep 17 00:00:00 2001 From: Zuhair Ahmad <157193652+Zuhair-CS@users.noreply.github.com> Date: Mon, 29 Sep 2025 11:25:07 +0530 Subject: [PATCH 2/7] Update index.js Signed-off-by: Zuhair Ahmad <157193652+Zuhair-CS@users.noreply.github.com> --- .../@stdlib/utils/object-inverse-by/examples/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/node_modules/@stdlib/utils/object-inverse-by/examples/index.js b/lib/node_modules/@stdlib/utils/object-inverse-by/examples/index.js index dd8d6982e46e..23f7e28a5150 100644 --- a/lib/node_modules/@stdlib/utils/object-inverse-by/examples/index.js +++ b/lib/node_modules/@stdlib/utils/object-inverse-by/examples/index.js @@ -24,7 +24,6 @@ var round = require( '@stdlib/math/base/special/round' ); var invertBy = require( './../lib' ); var keys; -var arr; var out; var i; From 2530a844a33ff0b6edcb7941b23bf44ad405db8a Mon Sep 17 00:00:00 2001 From: Zuhair Ahmad <157193652+Zuhair-CS@users.noreply.github.com> Date: Mon, 29 Sep 2025 11:29:05 +0530 Subject: [PATCH 3/7] Update index.js Signed-off-by: Zuhair Ahmad <157193652+Zuhair-CS@users.noreply.github.com> --- .../@stdlib/utils/object-inverse-by/examples/index.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/utils/object-inverse-by/examples/index.js b/lib/node_modules/@stdlib/utils/object-inverse-by/examples/index.js index 23f7e28a5150..3d8a1a443af7 100644 --- a/lib/node_modules/@stdlib/utils/object-inverse-by/examples/index.js +++ b/lib/node_modules/@stdlib/utils/object-inverse-by/examples/index.js @@ -32,9 +32,12 @@ function transform( key, value ) { } // Create an array of random integers... -const arr = Array.from({ length: 1000 }); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); +// Correct ES5-compatible code: +var arr = []; +var i; + +for ( i = 0; i < 1000; i++ ) { + arr.push( round( randu() * 100.0 ) ); } // Invert the array to determine value frequency... out = invertBy( arr, transform ); From 76620e994b97cb08951d5ae7d044d933be14ea37 Mon Sep 17 00:00:00 2001 From: Zuhair Ahmad <157193652+Zuhair-CS@users.noreply.github.com> Date: Mon, 29 Sep 2025 11:31:33 +0530 Subject: [PATCH 4/7] Update index.js Signed-off-by: Zuhair Ahmad <157193652+Zuhair-CS@users.noreply.github.com> --- .../@stdlib/utils/object-inverse-by/examples/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/node_modules/@stdlib/utils/object-inverse-by/examples/index.js b/lib/node_modules/@stdlib/utils/object-inverse-by/examples/index.js index 3d8a1a443af7..54b24df23317 100644 --- a/lib/node_modules/@stdlib/utils/object-inverse-by/examples/index.js +++ b/lib/node_modules/@stdlib/utils/object-inverse-by/examples/index.js @@ -25,7 +25,6 @@ var invertBy = require( './../lib' ); var keys; var out; -var i; function transform( key, value ) { return value; From 0d9412992a0a689909b7b1d2870c3fe84bdf5da9 Mon Sep 17 00:00:00 2001 From: Zuhair Ahmad <157193652+Zuhair-CS@users.noreply.github.com> Date: Mon, 29 Sep 2025 11:33:38 +0530 Subject: [PATCH 5/7] Update index.js Signed-off-by: Zuhair Ahmad <157193652+Zuhair-CS@users.noreply.github.com> --- .../@stdlib/utils/object-inverse-by/examples/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/utils/object-inverse-by/examples/index.js b/lib/node_modules/@stdlib/utils/object-inverse-by/examples/index.js index 54b24df23317..c2f57d49e2a9 100644 --- a/lib/node_modules/@stdlib/utils/object-inverse-by/examples/index.js +++ b/lib/node_modules/@stdlib/utils/object-inverse-by/examples/index.js @@ -36,7 +36,7 @@ var arr = []; var i; for ( i = 0; i < 1000; i++ ) { - arr.push( round( randu() * 100.0 ) ); + arr.push( round( randu() * 100.0 ) ); } // Invert the array to determine value frequency... out = invertBy( arr, transform ); From 0d6969e61521b4f1b6709f2212b2e451eca64ac0 Mon Sep 17 00:00:00 2001 From: Athan Date: Mon, 29 Sep 2025 12:16:18 +0100 Subject: [PATCH 6/7] chore: clean-up --- 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: 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/utils/object-inverse-by/README.md | 41 +++++++++---------- .../utils/object-inverse-by/docs/repl.txt | 8 ++-- .../object-inverse-by/docs/types/index.d.ts | 16 ++++---- .../utils/object-inverse-by/examples/index.js | 23 ++++------- 4 files changed, 40 insertions(+), 48 deletions(-) diff --git a/lib/node_modules/@stdlib/utils/object-inverse-by/README.md b/lib/node_modules/@stdlib/utils/object-inverse-by/README.md index 3fd534f6fb2a..8c1651d1a57a 100644 --- a/lib/node_modules/@stdlib/utils/object-inverse-by/README.md +++ b/lib/node_modules/@stdlib/utils/object-inverse-by/README.md @@ -32,7 +32,7 @@ var invertBy = require( '@stdlib/utils/object-inverse-by' ); #### invertBy( obj, \[options,] transform ) -Inverts an `object`, such that keys become values and values become keys, according to a `transform` function. +Inverts an object, such that keys become values and values become keys, according to a transform function. ```javascript function transform( key, value ) { @@ -46,11 +46,11 @@ var out = invertBy( obj, transform ); // returns { 'beep': 'a', 'boop': 'b' } ``` -The function accepts the following `options`: +The function accepts the following options: -- **duplicates**: `boolean` indicating whether to store keys mapped to duplicate values in `arrays`. Default: `true`. +- **duplicates**: boolean indicating whether to store keys mapped to duplicate values in arrays. Default: `true`. -By default, keys mapped to duplicate values are stored in `arrays`. +By default, keys mapped to duplicate values are stored in arrays. ```javascript function transform( key, value ) { @@ -64,7 +64,7 @@ var out = invertBy( obj, transform ); // returns { 'beep': [ 'a', 'b' ] } ``` -To **not** allow duplicates, set the `duplicates` option to `false`. The output `key-value` pair will be the `key` most recently inserted into the input `object`. +To **not** allow duplicates, set the `duplicates` option to `false`. The output key-value pair will be the key most recently inserted into the input object. ```javascript function transform( key, value ) { @@ -82,7 +82,7 @@ var out = invertBy( obj, opts, transform ); // returns { 'beep': 'c', 'boop': 'b' } ``` -The `transform` function is provided three arguments: +The transform function is provided three arguments: - **key**: object key. - **value**: object value corresponding to `key`. @@ -112,7 +112,7 @@ var out = invertBy( obj, transform ); ## Notes -- Beware when providing `objects` having values which are themselves `objects`. This function relies on native `object` serialization (`#toString`) when converting `transform` function return values to keys. +- Beware when providing objects having values which are themselves objects. This function relies on native object serialization (`#toString`) when converting transform function return values to keys. ```javascript function transform( key, value ) { @@ -129,7 +129,7 @@ var out = invertBy( obj, transform ); // returns { '1,2,3': 'a', '[object Object]': 'b' } ``` -- Insertion order is not guaranteed, as `object` key enumeration is not specified according to the [ECMAScript specification][ecma-262-for-in]. In practice, however, most engines use insertion order to sort an `object`'s keys, thus allowing for deterministic inversion. +- In older JavaScript engines, insertion order is not guaranteed, as object key enumeration was not specified according to the [ECMAScript specification][ecma-262-for-in] in earlier editions. In practice, however, most older engines use insertion order to sort an object's keys, thus allowing for deterministic inversion. @@ -142,27 +142,24 @@ var out = invertBy( obj, transform ); ```javascript -var randu = require( '@stdlib/random/base/randu' ); -var round = require( '@stdlib/math/base/special/round' ); +var objectKeys = require( '@stdlib/utils/keys' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); var invertBy = require( '@stdlib/utils/object-inverse-by' ); -var keys; -var arr; -var out; -var i; - function transform( key, value ) { return value; } -// Create an array of random integers... -arr = new Array( 1000 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} +// Create an array of random integers: +var arr = discreteUniform( 1000, 0, 100, { + 'dtype': 'generic' +}); + // Invert the array to determine value frequency... -out = invertBy( arr, transform ); -keys = Object.keys( out ); +var out = invertBy( arr, transform ); +var keys = objectKeys( out ); + +var i; for ( i = 0; i < keys.length; i++ ) { if ( out[ i ] ) { out[ i ] = out[ i ].length; diff --git a/lib/node_modules/@stdlib/utils/object-inverse-by/docs/repl.txt b/lib/node_modules/@stdlib/utils/object-inverse-by/docs/repl.txt index 2655f215b7ad..0cf84af38505 100644 --- a/lib/node_modules/@stdlib/utils/object-inverse-by/docs/repl.txt +++ b/lib/node_modules/@stdlib/utils/object-inverse-by/docs/repl.txt @@ -15,10 +15,10 @@ serialization (`#toString`) when converting transform function return values to keys. - Insertion order is not guaranteed, as object key enumeration is not - specified according to the ECMAScript specification. In practice, however, - most engines use insertion order to sort an object's keys, thus allowing for - deterministic inversion. + In older JavaScript engines, insertion order is not guaranteed, as object + key enumeration was not specified according to the ECMAScript specification + in earlier editions. In practice, however, most older engines use insertion + order to sort an object's keys, thus allowing for deterministic inversion. Parameters ---------- diff --git a/lib/node_modules/@stdlib/utils/object-inverse-by/docs/types/index.d.ts b/lib/node_modules/@stdlib/utils/object-inverse-by/docs/types/index.d.ts index c78ed046128f..2f903426aacd 100644 --- a/lib/node_modules/@stdlib/utils/object-inverse-by/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/utils/object-inverse-by/docs/types/index.d.ts @@ -79,13 +79,13 @@ type Transform = Nullary | Unary | Binary | Ternary; * * - The transform function is provided three arguments: * -* - `key`: object key -* - `value`: object value corresponding to `key` -* - `obj`: the input object +* - `key`: object key. +* - `value`: object value corresponding to `key`. +* - `obj`: the input object. * * - The value returned by a transform function should be a value which can be serialized as an object key. Hence, beware when providing objects having values which are themselves objects. The function relies on native object serialization (`#toString`) when converting transform function return values to keys. * -* - Insertion order is not guaranteed, as object key enumeration is not specified according to the ECMAScript specification. In practice, however, most engines use insertion order to sort an object's keys, thus allowing for deterministic inversion. +* - In older JavaScript engines, insertion order is not guaranteed, as object key enumeration was not specified according to the ECMAScript specification in earlier editions. In practice, however, most older engines use insertion order to sort an object's keys, thus allowing for deterministic inversion. * * @param obj - input object * @param transform - transform function @@ -122,13 +122,13 @@ declare function invertBy( obj: any, transform: Transform ): any; * * - The transform function is provided three arguments: * -* - `key`: object key -* - `value`: object value corresponding to `key` -* - `obj`: the input object +* - `key`: object key. +* - `value`: object value corresponding to `key`. +* - `obj`: the input object. * * - The value returned by a transform function should be a value which can be serialized as an object key. Hence, beware when providing objects having values which are themselves objects. The function relies on native object serialization (`#toString`) when converting transform function return values to keys. * -* - Insertion order is not guaranteed, as object key enumeration is not specified according to the ECMAScript specification. In practice, however, most engines use insertion order to sort an object's keys, thus allowing for deterministic inversion. +* - In older JavaScript engines, insertion order is not guaranteed, as object key enumeration was not specified according to the ECMAScript specification in earlier editions. In practice, however, most older engines use insertion order to sort an object's keys, thus allowing for deterministic inversion.s * * @param obj - input object * @param opts - function options diff --git a/lib/node_modules/@stdlib/utils/object-inverse-by/examples/index.js b/lib/node_modules/@stdlib/utils/object-inverse-by/examples/index.js index c2f57d49e2a9..b71ddc803884 100644 --- a/lib/node_modules/@stdlib/utils/object-inverse-by/examples/index.js +++ b/lib/node_modules/@stdlib/utils/object-inverse-by/examples/index.js @@ -19,28 +19,23 @@ 'use strict'; var objectKeys = require( '@stdlib/utils/keys' ); -var randu = require( '@stdlib/random/base/randu' ); -var round = require( '@stdlib/math/base/special/round' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); var invertBy = require( './../lib' ); -var keys; -var out; - function transform( key, value ) { return value; } -// Create an array of random integers... -// Correct ES5-compatible code: -var arr = []; -var i; +// Create an array of random integers: +var arr = discreteUniform( 1000, 0, 100, { + 'dtype': 'generic' +}); -for ( i = 0; i < 1000; i++ ) { - arr.push( round( randu() * 100.0 ) ); -} // Invert the array to determine value frequency... -out = invertBy( arr, transform ); -keys = objectKeys( out ); +var out = invertBy( arr, transform ); +var keys = objectKeys( out ); + +var i; for ( i = 0; i < keys.length; i++ ) { if ( out[ i ] ) { out[ i ] = out[ i ].length; From 581d06a0c97b26ea31d7cd1172efe45d131b1bc6 Mon Sep 17 00:00:00 2001 From: Athan Date: Mon, 29 Sep 2025 12:17:46 +0100 Subject: [PATCH 7/7] docs: fix stray character --- 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: na - 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: 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/utils/object-inverse-by/docs/types/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/utils/object-inverse-by/docs/types/index.d.ts b/lib/node_modules/@stdlib/utils/object-inverse-by/docs/types/index.d.ts index 2f903426aacd..942ca87be454 100644 --- a/lib/node_modules/@stdlib/utils/object-inverse-by/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/utils/object-inverse-by/docs/types/index.d.ts @@ -128,7 +128,7 @@ declare function invertBy( obj: any, transform: Transform ): any; * * - The value returned by a transform function should be a value which can be serialized as an object key. Hence, beware when providing objects having values which are themselves objects. The function relies on native object serialization (`#toString`) when converting transform function return values to keys. * -* - In older JavaScript engines, insertion order is not guaranteed, as object key enumeration was not specified according to the ECMAScript specification in earlier editions. In practice, however, most older engines use insertion order to sort an object's keys, thus allowing for deterministic inversion.s +* - In older JavaScript engines, insertion order is not guaranteed, as object key enumeration was not specified according to the ECMAScript specification in earlier editions. In practice, however, most older engines use insertion order to sort an object's keys, thus allowing for deterministic inversion. * * @param obj - input object * @param opts - function options