Skip to content

Commit 1b8f689

Browse files
committed
Auto-generated commit
1 parent 8491d4f commit 1b8f689

File tree

5 files changed

+46
-51
lines changed

5 files changed

+46
-51
lines changed

CHANGELOG.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@
148148

149149
### Closed Issues
150150

151-
A total of 10 issues were closed in this release:
151+
A total of 11 issues were closed in this release:
152152

153-
[#6004](https://github.com/stdlib-js/stdlib/issues/6004), [#6786](https://github.com/stdlib-js/stdlib/issues/6786), [#6800](https://github.com/stdlib-js/stdlib/issues/6800), [#7060](https://github.com/stdlib-js/stdlib/issues/7060), [#7350](https://github.com/stdlib-js/stdlib/issues/7350), [#7694](https://github.com/stdlib-js/stdlib/issues/7694), [#7914](https://github.com/stdlib-js/stdlib/issues/7914), [#8000](https://github.com/stdlib-js/stdlib/issues/8000), [#8043](https://github.com/stdlib-js/stdlib/issues/8043), [#8061](https://github.com/stdlib-js/stdlib/issues/8061)
153+
[#6004](https://github.com/stdlib-js/stdlib/issues/6004), [#6786](https://github.com/stdlib-js/stdlib/issues/6786), [#6800](https://github.com/stdlib-js/stdlib/issues/6800), [#7060](https://github.com/stdlib-js/stdlib/issues/7060), [#7350](https://github.com/stdlib-js/stdlib/issues/7350), [#7694](https://github.com/stdlib-js/stdlib/issues/7694), [#7914](https://github.com/stdlib-js/stdlib/issues/7914), [#8000](https://github.com/stdlib-js/stdlib/issues/8000), [#8043](https://github.com/stdlib-js/stdlib/issues/8043), [#8061](https://github.com/stdlib-js/stdlib/issues/8061), [#8155](https://github.com/stdlib-js/stdlib/issues/8155)
154154

155155
</section>
156156

@@ -162,6 +162,7 @@ A total of 10 issues were closed in this release:
162162

163163
<details>
164164

165+
- [`e00e353`](https://github.com/stdlib-js/stdlib/commit/e00e353d8e5861c42098e0322f7ba11ee784529d) - **chore:** resolve javascript lint errors [(#8158)](https://github.com/stdlib-js/stdlib/pull/8158) _(by Zuhair Ahmad, Athan Reines)_
165166
- [`d94514b`](https://github.com/stdlib-js/stdlib/commit/d94514bc9418f5b42df6233204d5005d53af00ca) - **docs:** clean-up TSDoc declaration comments _(by Philipp Burckhardt)_
166167
- [`07459d3`](https://github.com/stdlib-js/stdlib/commit/07459d3be48a57aac6cc018cbb456749fad79f6a) - **chore:** remove private annotations _(by Philipp Burckhardt)_
167168
- [`b7c2031`](https://github.com/stdlib-js/stdlib/commit/b7c20312491bdcf54ffc681e5fe489b9ba3d059c) - **docs:** clean-up TSDoc declaration comments _(by Philipp Burckhardt)_
@@ -252,7 +253,7 @@ A total of 10 issues were closed in this release:
252253

253254
### Contributors
254255

255-
A total of 13 people contributed to this release. Thank you to the following contributors:
256+
A total of 14 people contributed to this release. Thank you to the following contributors:
256257

257258
- Athan Reines
258259
- DUDHAT HEMIL PRAVINKUMAR
@@ -266,6 +267,7 @@ A total of 13 people contributed to this release. Thank you to the following con
266267
- Tyson Cung
267268
- Uday Kakade
268269
- Vara Rahul Rajana
270+
- Zuhair Ahmad
269271
- zhanggy
270272

271273
</section>

object-inverse-by/README.md

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ var invertBy = require( '@stdlib/utils/object-inverse-by' );
3232

3333
#### invertBy( obj, \[options,] transform )
3434

35-
Inverts an `object`, such that keys become values and values become keys, according to a `transform` function.
35+
Inverts an object, such that keys become values and values become keys, according to a transform function.
3636

3737
```javascript
3838
function transform( key, value ) {
@@ -46,11 +46,11 @@ var out = invertBy( obj, transform );
4646
// returns { 'beep': 'a', 'boop': 'b' }
4747
```
4848

49-
The function accepts the following `options`:
49+
The function accepts the following options:
5050

51-
- **duplicates**: `boolean` indicating whether to store keys mapped to duplicate values in `arrays`. Default: `true`.
51+
- **duplicates**: boolean indicating whether to store keys mapped to duplicate values in arrays. Default: `true`.
5252

53-
By default, keys mapped to duplicate values are stored in `arrays`.
53+
By default, keys mapped to duplicate values are stored in arrays.
5454

5555
```javascript
5656
function transform( key, value ) {
@@ -64,7 +64,7 @@ var out = invertBy( obj, transform );
6464
// returns { 'beep': [ 'a', 'b' ] }
6565
```
6666

67-
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`.
67+
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.
6868

6969
```javascript
7070
function transform( key, value ) {
@@ -82,7 +82,7 @@ var out = invertBy( obj, opts, transform );
8282
// returns { 'beep': 'c', 'boop': 'b' }
8383
```
8484

85-
The `transform` function is provided three arguments:
85+
The transform function is provided three arguments:
8686

8787
- **key**: object key.
8888
- **value**: object value corresponding to `key`.
@@ -112,7 +112,7 @@ var out = invertBy( obj, transform );
112112

113113
## Notes
114114

115-
- 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.
115+
- 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.
116116

117117
```javascript
118118
function transform( key, value ) {
@@ -129,7 +129,7 @@ var out = invertBy( obj, transform );
129129
// returns { '1,2,3': 'a', '[object Object]': 'b' }
130130
```
131131

132-
- 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.
132+
- 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.
133133
134134
</section>
135135
@@ -142,27 +142,24 @@ var out = invertBy( obj, transform );
142142
<!-- eslint no-undef: "error" -->
143143
144144
```javascript
145-
var randu = require( '@stdlib/random/base/randu' );
146-
var round = require( '@stdlib/math/base/special/round' );
145+
var objectKeys = require( '@stdlib/utils/keys' );
146+
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
147147
var invertBy = require( '@stdlib/utils/object-inverse-by' );
148148
149-
var keys;
150-
var arr;
151-
var out;
152-
var i;
153-
154149
function transform( key, value ) {
155150
return value;
156151
}
157152
158-
// Create an array of random integers...
159-
arr = new Array( 1000 );
160-
for ( i = 0; i < arr.length; i++ ) {
161-
arr[ i ] = round( randu()*100.0 );
162-
}
153+
// Create an array of random integers:
154+
var arr = discreteUniform( 1000, 0, 100, {
155+
'dtype': 'generic'
156+
});
157+
163158
// Invert the array to determine value frequency...
164-
out = invertBy( arr, transform );
165-
keys = Object.keys( out );
159+
var out = invertBy( arr, transform );
160+
var keys = objectKeys( out );
161+
162+
var i;
166163
for ( i = 0; i < keys.length; i++ ) {
167164
if ( out[ i ] ) {
168165
out[ i ] = out[ i ].length;

object-inverse-by/docs/repl.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
serialization (`#toString`) when converting transform function return values
1616
to keys.
1717

18-
Insertion order is not guaranteed, as object key enumeration is not
19-
specified according to the ECMAScript specification. In practice, however,
20-
most engines use insertion order to sort an object's keys, thus allowing for
21-
deterministic inversion.
18+
In older JavaScript engines, insertion order is not guaranteed, as object
19+
key enumeration was not specified according to the ECMAScript specification
20+
in earlier editions. In practice, however, most older engines use insertion
21+
order to sort an object's keys, thus allowing for deterministic inversion.
2222

2323
Parameters
2424
----------

object-inverse-by/docs/types/index.d.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,13 @@ type Transform = Nullary | Unary | Binary | Ternary;
7979
*
8080
* - The transform function is provided three arguments:
8181
*
82-
* - `key`: object key
83-
* - `value`: object value corresponding to `key`
84-
* - `obj`: the input object
82+
* - `key`: object key.
83+
* - `value`: object value corresponding to `key`.
84+
* - `obj`: the input object.
8585
*
8686
* - 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.
8787
*
88-
* - 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.
88+
* - 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.
8989
*
9090
* @param obj - input object
9191
* @param transform - transform function
@@ -122,13 +122,13 @@ declare function invertBy( obj: any, transform: Transform ): any;
122122
*
123123
* - The transform function is provided three arguments:
124124
*
125-
* - `key`: object key
126-
* - `value`: object value corresponding to `key`
127-
* - `obj`: the input object
125+
* - `key`: object key.
126+
* - `value`: object value corresponding to `key`.
127+
* - `obj`: the input object.
128128
*
129129
* - 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.
130130
*
131-
* - 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.
131+
* - 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.
132132
*
133133
* @param obj - input object
134134
* @param opts - function options

object-inverse-by/examples/index.js

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,23 @@
1919
'use strict';
2020

2121
var objectKeys = require( './../../keys' );
22-
var randu = require( '@stdlib/random/base/randu' );
23-
var round = require( '@stdlib/math/base/special/round' );
22+
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
2423
var invertBy = require( './../lib' );
2524

26-
var keys;
27-
var arr;
28-
var out;
29-
var i;
30-
3125
function transform( key, value ) {
3226
return value;
3327
}
3428

35-
// Create an array of random integers...
36-
arr = new Array( 1000 );
37-
for ( i = 0; i < arr.length; i++ ) {
38-
arr[ i ] = round( randu()*100.0 );
39-
}
29+
// Create an array of random integers:
30+
var arr = discreteUniform( 1000, 0, 100, {
31+
'dtype': 'generic'
32+
});
33+
4034
// Invert the array to determine value frequency...
41-
out = invertBy( arr, transform );
42-
keys = objectKeys( out );
35+
var out = invertBy( arr, transform );
36+
var keys = objectKeys( out );
37+
38+
var i;
4339
for ( i = 0; i < keys.length; i++ ) {
4440
if ( out[ i ] ) {
4541
out[ i ] = out[ i ].length;

0 commit comments

Comments
 (0)