Skip to content

Commit 74a0fcf

Browse files
authored
Merge branch 'stdlib-js:develop' into blas-ndarray-findIndex
2 parents c7d5352 + cd135d6 commit 74a0fcf

File tree

388 files changed

+31389
-751
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

388 files changed

+31389
-751
lines changed

CONTRIBUTORS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Abdelrahman Samir <[email protected]>
99
Abdul Kaium <[email protected]>
1010
Abhay Punia <[email protected]>
1111
Abhijit Raut <[email protected]>
12+
Abhishek G <[email protected]>
1213
Abhishek Jain <[email protected]>
1314
Adarsh Palaskar <[email protected]>
1415
Aditya Sapra <[email protected]>
@@ -30,6 +31,7 @@ Anshu Kumar <[email protected]>
3031
Anudeep Sanapala <[email protected]>
3132
Arihant Pal <[email protected]>
3233
Aryan Bhirud <[email protected]>
34+
3335
Athan Reines <[email protected]>
3436
Atharva Patil <[email protected]>
3537
@@ -118,6 +120,7 @@ Momtchil Momtchev <[email protected]>
118120
Muhammad Haris <[email protected]>
119121
Muhammad Taaha Tariq <[email protected]>
120122
Muhmmad Saad <[email protected]>
123+
NEEKUorAAYUSH <[email protected]>
121124
Naresh Jagadeesan <[email protected]>
122125
Naveen Kumar <[email protected]>
123126
Neeraj Pathak <[email protected]>
@@ -132,6 +135,7 @@ Oneday12323 <[email protected]>
132135
Ori Miles <[email protected]>
133136
Philipp Burckhardt <[email protected]>
134137
Pierre Forstmann <[email protected]>
138+
Pradyumn Prasad <[email protected]>
135139
Prajjwal Bajpai <[email protected]>
136140
Prajwal Kulkarni <[email protected]>
137141
Pranav Goswami <[email protected]>
@@ -177,6 +181,7 @@ Shivansh <[email protected]>
177181
Shraddheya Shendre <[email protected]>
178182
Shubh Mehta <[email protected]>
179183
Shubham Mishra <[email protected]>
184+
Siddhesh waje <[email protected]>
180185
Sivam Das <[email protected]>
181186
Snehil Shah <[email protected]>
182187
Soumajit Chatterjee <[email protected]>
@@ -196,6 +201,7 @@ Utkarsh <http://[email protected]>
196201
Utkarsh Raj <[email protected]>
197202
UtkershBasnet <[email protected]>
198203
Vaibhav Patel <[email protected]>
204+
Vansh Choudhary <[email protected]>
199205
Vara Rahul Rajana <[email protected]>
200206
Varad Gupta <[email protected]>
201207
Vinit Pandit <[email protected]>

lib/node_modules/@stdlib/_tools/pkgs/deps/lib/resolve.sync.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function resolve( entries, builtins ) {
5050
var k;
5151

5252
len = entries.length;
53-
cache = new Array( len );
53+
cache = [];
5454

5555
opts = {
5656
'walk': true,
@@ -63,10 +63,10 @@ function resolve( entries, builtins ) {
6363
pkg = entries[ i ].pkg;
6464
k = i + 1;
6565

66-
cache[ i ] = {
66+
cache.push({
6767
'pkg': entries[ i ].pkg,
6868
'dir': entries[ i ].dir
69-
};
69+
});
7070
debug( 'Resolving package: %s (%d of %d)...', pkg, k, len );
7171
results = pkgDeps( entries[ i ].entries, opts );
7272
if ( results instanceof Error ) {
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<!--
2+
3+
@license Apache-2.0
4+
5+
Copyright (c) 2025 The Stdlib Authors.
6+
7+
Licensed under the Apache License, Version 2.0 (the "License");
8+
you may not use this file except in compliance with the License.
9+
You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
19+
-->
20+
21+
# entries2objects
22+
23+
> Convert array entries to an array of objects.
24+
25+
<section class="usage">
26+
27+
## Usage
28+
29+
```javascript
30+
var entries2objects = require( '@stdlib/array/base/entries2objects' );
31+
```
32+
33+
#### entries2objects( arr, fields )
34+
35+
Converts array entries to an array of objects.
36+
37+
```javascript
38+
var x = [ 1, 2 ];
39+
40+
var fields = [ 'x', 'y' ];
41+
42+
var out = entries2objects( x, fields );
43+
// returns [ { 'x': 0, 'y': 1 }, { 'x': 1, 'y': 2 } ]
44+
```
45+
46+
The function supports the following parameters:
47+
48+
- **arr**: input array.
49+
- **fields**: list of field names.
50+
51+
</section>
52+
53+
<!-- /.usage -->
54+
55+
<section class="notes">
56+
57+
- The list of field names should be a two-element array where the first element corresponds to the field name of input array element index and the second element corresponds to the field name of the input array element value.
58+
59+
</section>
60+
61+
<!-- /.notes -->
62+
63+
<section class="examples">
64+
65+
## Examples
66+
67+
<!-- eslint no-undef: "error" -->
68+
69+
```javascript
70+
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
71+
var entries2objects = require( '@stdlib/array/base/entries2objects' );
72+
73+
var x = discreteUniform( 10, -100, 100 );
74+
var fields = [ 'x', 'y' ];
75+
76+
var out = entries2objects( x, fields );
77+
// returns [...]
78+
```
79+
80+
</section>
81+
82+
<!-- /.examples -->
83+
84+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
85+
86+
<section class="related">
87+
88+
</section>
89+
90+
<!-- /.related -->
91+
92+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
93+
94+
<section class="links">
95+
96+
</section>
97+
98+
<!-- /.links -->
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var bench = require( '@stdlib/bench' );
24+
var isArray = require( '@stdlib/assert/is-array' );
25+
var zeroTo = require( '@stdlib/array/base/zero-to' );
26+
var pkg = require( './../package.json' ).name;
27+
var entries2objects = require( './../lib' );
28+
29+
30+
// MAIN //
31+
32+
bench( pkg+':len=10', function benchmark( b ) {
33+
var labels;
34+
var x;
35+
var i;
36+
var v;
37+
38+
labels = [ 'x', 'y' ];
39+
x = zeroTo( 10 );
40+
41+
b.tic();
42+
for ( i = 0; i < b.iterations; i++ ) {
43+
v = entries2objects( x, labels );
44+
if ( typeof v !== 'object' ) {
45+
b.fail( 'should return an array' );
46+
}
47+
}
48+
b.toc();
49+
if ( !isArray( v ) ) {
50+
b.fail( 'should return an array' );
51+
}
52+
b.pass( 'benchmark finished' );
53+
b.end();
54+
});
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var bench = require( '@stdlib/bench' );
24+
var pow = require( '@stdlib/math/base/special/pow' );
25+
var zeroTo = require( '@stdlib/array/base/zero-to' );
26+
var isArray = require( '@stdlib/assert/is-array' );
27+
var pkg = require( './../package.json' ).name;
28+
var entries2objects = require( './../lib' );
29+
30+
31+
// FUNCTIONS //
32+
33+
/**
34+
* Creates a benchmark function.
35+
*
36+
* @private
37+
* @param {PositiveInteger} len - array length
38+
* @returns {Function} benchmark function
39+
*/
40+
function createBenchmark( len ) {
41+
var labels = [ 'x', 'y' ];
42+
var x = zeroTo( len );
43+
return benchmark;
44+
45+
/**
46+
* Benchmark function.
47+
*
48+
* @private
49+
* @param {Benchmark} b - benchmark instance
50+
*/
51+
function benchmark( b ) {
52+
var v;
53+
var i;
54+
55+
b.tic();
56+
for ( i = 0; i < b.iterations; i++ ) {
57+
v = entries2objects( x, labels );
58+
if ( typeof v !== 'object' ) {
59+
b.fail( 'should return an array' );
60+
}
61+
}
62+
b.toc();
63+
if ( !isArray( v ) ) {
64+
b.fail( 'should return an array' );
65+
}
66+
b.pass( 'benchmark finished' );
67+
b.end();
68+
}
69+
}
70+
71+
72+
// MAIN //
73+
74+
/**
75+
* Main execution sequence.
76+
*
77+
* @private
78+
*/
79+
function main() {
80+
var len;
81+
var min;
82+
var max;
83+
var f;
84+
var i;
85+
86+
min = 1; // 10^min
87+
max = 6; // 10^max
88+
89+
for ( i = min; i <= max; i++ ) {
90+
len = pow( 10, i );
91+
f = createBenchmark( len );
92+
bench( pkg+':len='+len, f );
93+
}
94+
}
95+
96+
main();
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
{{alias}}( arr, fields )
3+
Converts array entries to an array of objects.
4+
5+
The list of field names should be a two-element array where the first
6+
element corresponds to the field name of input array element index and the
7+
second element corresponds to the field name of the input array element
8+
value.
9+
10+
Parameters
11+
----------
12+
arr: ArrayLikeObject
13+
Input array.
14+
15+
fields: ArrayLikeObject
16+
List of field names.
17+
18+
Returns
19+
-------
20+
out: Array<Object>
21+
Output array.
22+
23+
Examples
24+
--------
25+
> var x = [ 1, 2 ];
26+
> var f = [ 'x', 'y' ];
27+
> var out = {{alias}}( x, f )
28+
[ { 'x': 0, 'y': 1 }, { 'x': 1, 'y': 2 } ]
29+
30+
See Also
31+
--------
32+

0 commit comments

Comments
 (0)