Skip to content

Commit 03b248b

Browse files
committed
Auto-generated commit
1 parent 0dfdb0c commit 03b248b

16 files changed

+587
-20
lines changed

.github/workflows/productionize.yml

-3
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,6 @@ jobs:
344344
uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2
345345
with:
346346
status: ${{ job.status }}
347-
steps: ${{ toJson(steps) }}
348347
channel: '#npm-ci'
349348
if: failure()
350349

@@ -518,7 +517,6 @@ jobs:
518517
uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2
519518
with:
520519
status: ${{ job.status }}
521-
steps: ${{ toJson(steps) }}
522520
channel: '#npm-ci'
523521
if: failure()
524522

@@ -698,7 +696,6 @@ jobs:
698696
uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2
699697
with:
700698
status: ${{ job.status }}
701-
steps: ${{ toJson(steps) }}
702699
channel: '#npm-ci'
703700
if: failure()
704701

.github/workflows/publish.yml

-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ jobs:
218218
uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2
219219
with:
220220
status: ${{ job.status }}
221-
steps: ${{ toJson(steps) }}
222221
channel: '#npm-ci'
223222
if: failure()
224223

.github/workflows/test.yml

-1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,5 @@ jobs:
9595
uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2
9696
with:
9797
status: ${{ job.status }}
98-
steps: ${{ toJson(steps) }}
9998
channel: '#npm-ci'
10099
if: failure()

.github/workflows/test_bundles.yml

-3
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ jobs:
9494
uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2
9595
with:
9696
status: ${{ job.status }}
97-
steps: ${{ toJson(steps) }}
9897
channel: '#npm-ci'
9998
if: failure()
10099

@@ -139,7 +138,6 @@ jobs:
139138
uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2
140139
with:
141140
status: ${{ job.status }}
142-
steps: ${{ toJson(steps) }}
143141
channel: '#npm-ci'
144142
if: failure()
145143

@@ -184,6 +182,5 @@ jobs:
184182
uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2
185183
with:
186184
status: ${{ job.status }}
187-
steps: ${{ toJson(steps) }}
188185
channel: '#npm-ci'
189186
if: failure()

.github/workflows/test_coverage.yml

-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ jobs:
119119
uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2
120120
with:
121121
status: ${{ job.status }}
122-
steps: ${{ toJson(steps) }}
123122
channel: '#npm-ci'
124123
if: failure()
125124

.github/workflows/test_install.yml

-1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,5 @@ jobs:
8181
uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2
8282
with:
8383
status: ${{ job.status }}
84-
steps: ${{ toJson(steps) }}
8584
channel: '#npm-ci'
8685
if: failure()

CONTRIBUTORS

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
Adarsh Palaskar <[email protected]>
66
Aditya Sapra <[email protected]>
77
AgPriyanshu18 <[email protected]>
8+
Aleksandr <[email protected]>
89
Ali Salesi <[email protected]>
910
Aman Bhansali <[email protected]>
1011
Amit Jimiwal <[email protected]>
@@ -69,8 +70,10 @@ Seyyed Parsa Neshaei <[email protected]>
6970
Shashank Shekhar Singh <[email protected]>
7071
7172
Shraddheya Shendre <[email protected]>
73+
Shubh Mehta <[email protected]>
7274
Shubham Mishra <[email protected]>
7375
Snehil Shah <[email protected]>
76+
Soumajit Chatterjee <[email protected]>
7477
Spandan Barve <[email protected]>
7578
Stephannie Jiménez Gacha <[email protected]>
7679
Suraj kumar <[email protected]>
@@ -83,4 +86,5 @@ Yernar Yergaziyev <[email protected]>
8386
8487
nishant-s7 <[email protected]>
8588
orimiles5 <[email protected]>
89+
8690

README.md

+32-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
@license Apache-2.0
44
5-
Copyright (c) 2018 The Stdlib Authors.
5+
Copyright (c) 2024 The Stdlib Authors.
66
77
Licensed under the Apache License, Version 2.0 (the "License");
88
you may not use this file except in compliance with the License.
@@ -1538,6 +1538,35 @@ var str = arr.join( '/' );
15381538
// returns '1 + 1i/2 - 2i/3 + 3i'
15391539
```
15401540

1541+
<a name="method-keys"></a>
1542+
1543+
#### Complex128Array.prototype.keys()
1544+
1545+
Returns an iterator for iterating over each index key in a typed array.
1546+
1547+
```javascript
1548+
var arr = new Complex128Array( 2 );
1549+
1550+
arr.set( [ 1.0, -1.0 ], 0 );
1551+
arr.set( [ 2.0, -2.0 ], 1 );
1552+
1553+
var iter = arr.keys();
1554+
1555+
var v = iter.next().value;
1556+
// returns 0
1557+
1558+
v = iter.next().value;
1559+
// returns 1
1560+
1561+
var bool = iter.next().done;
1562+
// returns true
1563+
```
1564+
1565+
The returned [iterator][mdn-iterator-protocol] protocol-compliant object has the following properties:
1566+
1567+
- **next**: function which returns an [iterator][mdn-iterator-protocol] protocol-compliant object containing the next iterated value (if one exists) assigned to a `value` property and a `done` property having a `boolean` value indicating whether the [iterator][mdn-iterator-protocol] is finished.
1568+
- **return**: function which closes an [iterator][mdn-iterator-protocol] and returns a single (optional) argument in an [iterator][mdn-iterator-protocol] protocol-compliant object.
1569+
15411570
<a name="method-last-index-of"></a>
15421571

15431572
#### Complex128Array.prototype.lastIndexOf( searchElement\[, fromIndex] )
@@ -2451,6 +2480,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
24512480

24522481
[stdlib-license]: https://raw.githubusercontent.com/stdlib-js/array-complex128/main/LICENSE
24532482

2483+
[mdn-iterator-protocol]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterator_protocol
2484+
24542485
[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed
24552486

24562487
[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer

benchmark/benchmark.keys.js

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2024 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-harness' );
24+
var isIteratorLike = require( '@stdlib/assert-is-iterator-like' );
25+
var pkg = require( './../package.json' ).name;
26+
var Complex128Array = require( './../lib' );
27+
28+
29+
// MAIN //
30+
31+
bench( pkg+':keys:len=2', function benchmark( b ) {
32+
var iter;
33+
var arr;
34+
var i;
35+
36+
arr = new Complex128Array( [ 1.0, -1.0, 2.0, -2.0 ] );
37+
38+
b.tic();
39+
for ( i = 0; i < b.iterations; i++ ) {
40+
iter = arr.keys();
41+
if ( typeof iter !== 'object' ) {
42+
b.fail( 'should return an object' );
43+
}
44+
}
45+
b.toc();
46+
if ( !isIteratorLike( iter ) ) {
47+
b.fail( 'should return an iterator protocol-compliant object' );
48+
}
49+
b.pass( 'benchmark finished' );
50+
b.end();
51+
});

benchmark/benchmark.keys.length.js

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2024 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-harness' );
24+
var pow = require( '@stdlib/math-base-special-pow' );
25+
var Complex128 = require( '@stdlib/complex-float64' );
26+
var isIteratorLike = require('@stdlib/assert-is-iterator-like');
27+
var pkg = require( './../package.json' ).name;
28+
var Complex128Array = 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 arr;
42+
var i;
43+
44+
arr = [];
45+
for ( i = 0; i < len; i++ ) {
46+
arr.push( new Complex128( i, i ) );
47+
}
48+
arr = new Complex128Array( arr );
49+
50+
return benchmark;
51+
52+
/**
53+
* Benchmark function.
54+
*
55+
* @private
56+
* @param {Benchmark} b - benchmark instance
57+
*/
58+
function benchmark( b ) {
59+
var iter;
60+
var i;
61+
62+
b.tic();
63+
for ( i = 0; i < b.iterations; i++ ) {
64+
iter = arr.keys();
65+
if ( typeof iter !== 'object' ) {
66+
b.fail( 'should return an object' );
67+
}
68+
}
69+
b.toc();
70+
if ( !isIteratorLike( iter ) ) {
71+
b.fail( 'should return an iterator protocol-compliant object' );
72+
}
73+
b.pass( 'benchmark finished' );
74+
b.end();
75+
}
76+
}
77+
78+
79+
// MAIN //
80+
81+
/**
82+
* Main execution sequence.
83+
*
84+
* @private
85+
*/
86+
function main() {
87+
var len;
88+
var min;
89+
var max;
90+
var f;
91+
var i;
92+
93+
min = 1; // 10^min
94+
max = 6; // 10^max
95+
96+
for ( i = min; i <= max; i++ ) {
97+
len = pow( 10, i );
98+
f = createBenchmark( len );
99+
bench( pkg+':keys:len='+len, f );
100+
}
101+
}
102+
103+
main();

dist/index.js

+6-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/types/index.d.ts

+25-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/*
44
* @license Apache-2.0
55
*
6-
* Copyright (c) 2021 The Stdlib Authors.
6+
* Copyright (c) 2024 The Stdlib Authors.
77
*
88
* Licensed under the Apache License, Version 2.0 (the "License");
99
* you may not use this file except in compliance with the License.
@@ -800,6 +800,30 @@ declare class Complex128Array implements Complex128ArrayInterface {
800800
*/
801801
join( separator?: string ): string;
802802

803+
/**
804+
* Returns an iterator for iterating over each index key in a typed array.
805+
*
806+
* @returns iterator
807+
*
808+
* @example
809+
* var arr = new Complex128Array( 2 );
810+
*
811+
* arr.set( [ 1.0, 1.0 ], 0 );
812+
* arr.set( [ 2.0, 2.0 ], 1 );
813+
*
814+
* var iter = arr.keys();
815+
*
816+
* var v = iter.next().value;
817+
* // returns 0
818+
*
819+
* v = iter.next().value;
820+
* // returns 1
821+
*
822+
* var bool = iter.next().done;
823+
* // returns true
824+
*/
825+
keys(): TypedIterator<number>;
826+
803827
/**
804828
* Returns the last index at which a given element can be found.
805829
*

0 commit comments

Comments
 (0)