Skip to content

Commit 1226c95

Browse files
committed
Auto-generated commit
1 parent ea0e5df commit 1226c95

File tree

17 files changed

+7143
-5592
lines changed

17 files changed

+7143
-5592
lines changed

.github/workflows/productionize.yml

+10-10
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ jobs:
9494
node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );"
9595
fi
9696
97-
# Configure git:
98-
- name: 'Configure git'
97+
# Configure Git:
98+
- name: 'Configure Git'
9999
run: |
100100
git config --local user.email "[email protected]"
101101
git config --local user.name "stdlib-bot"
@@ -191,8 +191,8 @@ jobs:
191191
# Pin action to full length commit SHA
192192
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
193193

194-
# Configure git:
195-
- name: 'Configure git'
194+
# Configure Git:
195+
- name: 'Configure Git'
196196
run: |
197197
git config --local user.email "[email protected]"
198198
git config --local user.name "stdlib-bot"
@@ -366,8 +366,8 @@ jobs:
366366
# Pin action to full length commit SHA
367367
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
368368

369-
# Configure git:
370-
- name: 'Configure git'
369+
# Configure Git:
370+
- name: 'Configure Git'
371371
run: |
372372
git config --local user.email "[email protected]"
373373
git config --local user.name "stdlib-bot"
@@ -539,8 +539,8 @@ jobs:
539539
# Pin action to full length commit SHA
540540
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
541541

542-
# Configure git:
543-
- name: 'Configure git'
542+
# Configure Git:
543+
- name: 'Configure Git'
544544
run: |
545545
git config --local user.email "[email protected]"
546546
git config --local user.name "stdlib-bot"
@@ -735,8 +735,8 @@ jobs:
735735
echo "bump=true" >> $GITHUB_OUTPUT
736736
fi
737737
738-
# Configure git:
739-
- name: 'Configure git'
738+
# Configure Git:
739+
- name: 'Configure Git'
740740
if: steps.check-if-bump.outputs.bump
741741
run: |
742742
git config --local user.email "[email protected]"

.github/workflows/publish.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ jobs:
7272
node-version: 20
7373
timeout-minutes: 5
7474

75-
# Configure git:
76-
- name: 'Configure git'
75+
# Configure Git:
76+
- name: 'Configure Git'
7777
run: |
7878
git config --local user.email "[email protected]"
7979
git config --local user.name "stdlib-bot"
@@ -164,7 +164,7 @@ jobs:
164164
# Publish package to npm:
165165
- name: 'Publish package to npm'
166166
# Pin action to full length commit SHA
167-
uses: JS-DevTools/npm-publish@4b07b26a2f6e0a51846e1870223e545bae91c552 # v3.0.1
167+
uses: JS-DevTools/npm-publish@19c28f1ef146469e409470805ea4279d47c3d35c # v3.1.1
168168
with:
169169
token: ${{ secrets.NPM_TOKEN }}
170170
access: public

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ docs/**/node_modules/
101101
pids
102102
*.pid
103103
*.seed
104+
yarn.lock
105+
package-lock.json
104106

105107
# Typescript #
106108
##############

.npmrc

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ shrinkwrap = false
2727
# Disable automatically "saving" dependencies on install:
2828
save = false
2929

30-
# Generate provenance metadata:
31-
provenance = true
30+
# Do not generate provenance metadata:
31+
provenance = false

CHANGELOG.md

+6,394-5,577
Large diffs are not rendered by default.

CONTRIBUTORS

+3
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,13 @@ Marcus Fantham <[email protected]>
4646
Matt Cochrane <[email protected]>
4747
Mihir Pandit <[email protected]>
4848
Milan Raj <[email protected]>
49+
Mohammad Kaif <[email protected]>
4950
Momtchil Momtchev <[email protected]>
5051
Muhammad Haris <[email protected]>
5152
Naresh Jagadeesan <[email protected]>
5253
NightKnight <[email protected]>
5354
Nithin Katta <[email protected]>
55+
Nourhan Hasan <[email protected]>
5456
Ognjen Jevremović <[email protected]>
5557
Oneday12323 <[email protected]>
5658
Philipp Burckhardt <[email protected]>
@@ -69,6 +71,7 @@ Roman Stetsyk <[email protected]>
6971
7072
Ryan Seal <[email protected]>
7173
Sai Srikar Dumpeti <[email protected]>
74+
SarthakPaandey <[email protected]>
7275
Seyyed Parsa Neshaei <[email protected]>
7376
Shashank Shekhar Singh <[email protected]>
7477

base/lib/index.js

+18
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,15 @@ setReadOnly( ns, 'cuany', require( './../../base/cuany' ) );
486486
*/
487487
setReadOnly( ns, 'cuevery', require( './../../base/cuevery' ) );
488488

489+
/**
490+
* @name cunone
491+
* @memberof ns
492+
* @readonly
493+
* @type {Function}
494+
* @see {@link module:@stdlib/array/base/cunone}
495+
*/
496+
setReadOnly( ns, 'cunone', require( './../../base/cunone' ) );
497+
489498
/**
490499
* @name dedupe
491500
* @memberof ns
@@ -1269,6 +1278,15 @@ setReadOnly( ns, 'quinary5d', require( './../../base/quinary5d' ) );
12691278
*/
12701279
setReadOnly( ns, 'reject', require( './../../base/reject' ) );
12711280

1281+
/**
1282+
* @name removeAt
1283+
* @memberof ns
1284+
* @readonly
1285+
* @type {Function}
1286+
* @see {@link module:@stdlib/array/base/remove-at}
1287+
*/
1288+
setReadOnly( ns, 'removeAt', require( './../../base/remove-at' ) );
1289+
12721290
/**
12731291
* @name resolveGetter
12741292
* @memberof ns

base/remove-at/README.md

+133
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
<!--
2+
3+
@license Apache-2.0
4+
5+
Copyright (c) 2024 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+
# removeAt
22+
23+
> Remove an element from an array.
24+
25+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
26+
27+
<section class="intro">
28+
29+
</section>
30+
31+
<!-- /.intro -->
32+
33+
<!-- Package usage documentation. -->
34+
35+
<section class="usage">
36+
37+
## Usage
38+
39+
```javascript
40+
var removeAt = require( '@stdlib/array/base/remove-at' );
41+
```
42+
43+
#### removeAt( x, index )
44+
45+
Removes an element from an array.
46+
47+
```javascript
48+
var x = [ 1, 1, 2, 3, 3 ];
49+
50+
var y = removeAt( x, -3 );
51+
// returns [ 1, 1, 3, 3 ]
52+
53+
var bool = ( x === y );
54+
// returns true
55+
```
56+
57+
The function accepts the following arguments:
58+
59+
- **x**: an input array.
60+
- **index**: element index.
61+
62+
</section>
63+
64+
<!-- /.usage -->
65+
66+
<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
67+
68+
<section class="notes">
69+
70+
## Notes
71+
72+
- Negative indices are resolved relative to the last array element, with the last element corresponding to `-1`.
73+
- If provided out-of-bounds indices, the function returns the input array unchanged; otherwise, the function mutates the input array.
74+
75+
</section>
76+
77+
<!-- /.notes -->
78+
79+
<!-- Package usage examples. -->
80+
81+
<section class="examples">
82+
83+
## Examples
84+
85+
<!-- eslint no-undef: "error" -->
86+
87+
```javascript
88+
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
89+
var randi = require( '@stdlib/random/base/discrete-uniform' );
90+
var removeAt = require( '@stdlib/array/base/remove-at' );
91+
92+
// Create an array of random numbers:
93+
var x = discreteUniform( 10, 0, 5, {
94+
'dtype': 'generic'
95+
});
96+
// returns [...]
97+
98+
console.log( x );
99+
100+
// Remove a random element:
101+
var y = removeAt( x, randi( 0, x.length-1 ) );
102+
// returns [...]
103+
104+
console.log( y );
105+
```
106+
107+
</section>
108+
109+
<!-- /.examples -->
110+
111+
<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
112+
113+
<section class="references">
114+
115+
</section>
116+
117+
<!-- /.references -->
118+
119+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
120+
121+
<section class="related">
122+
123+
</section>
124+
125+
<!-- /.related -->
126+
127+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
128+
129+
<section class="links">
130+
131+
</section>
132+
133+
<!-- /.links -->

base/remove-at/benchmark/benchmark.js

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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' );
24+
var uniform = require( '@stdlib/random/array/uniform' );
25+
var isArray = require( '@stdlib/assert/is-array' );
26+
var pkg = require( './../package.json' ).name;
27+
var removeAt = require( './../lib' );
28+
29+
30+
// MAIN //
31+
32+
bench( pkg+':index=-1', function benchmark( b ) {
33+
var out;
34+
var x;
35+
var i;
36+
37+
x = uniform( b.iterations+1, 0.0, 10.0, {
38+
'dtype': 'generic'
39+
});
40+
41+
b.tic();
42+
for ( i = 0; i < b.iterations; i++ ) {
43+
out = removeAt( x, -1 );
44+
if ( out.length === 0 ) {
45+
b.fail( 'unexpected length' );
46+
}
47+
}
48+
b.toc();
49+
if ( !isArray( out ) ) {
50+
b.fail( 'should return an array' );
51+
}
52+
b.pass( 'benchmark finished' );
53+
b.end();
54+
});
55+
56+
bench( pkg+':index=0', function benchmark( b ) {
57+
var out;
58+
var x;
59+
var i;
60+
61+
x = uniform( b.iterations+1, 0.0, 10.0, {
62+
'dtype': 'generic'
63+
});
64+
65+
b.tic();
66+
for ( i = 0; i < b.iterations; i++ ) {
67+
out = removeAt( x, 0 );
68+
if ( out.length === 0 ) {
69+
b.fail( 'unexpected length' );
70+
}
71+
}
72+
b.toc();
73+
if ( !isArray( out ) ) {
74+
b.fail( 'should return an array' );
75+
}
76+
b.pass( 'benchmark finished' );
77+
b.end();
78+
});

base/remove-at/docs/repl.txt

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
{{alias}}( x, index )
3+
Removes an element from an array.
4+
5+
Negative indices are resolved relative to the last array element, with the
6+
last element corresponding to `-1`.
7+
8+
If provided an out-of-bounds index, the function returns the input array
9+
unchanged; otherwise, the function mutates the input array.
10+
11+
Parameters
12+
----------
13+
x: Array
14+
Input array.
15+
16+
index: integer
17+
Element index.
18+
19+
Returns
20+
-------
21+
out: Array
22+
Input array.
23+
24+
Examples
25+
--------
26+
> var x = [ 1, 1, 2, 3, 3 ];
27+
> var out = {{alias}}( x, -3 )
28+
[ 1, 1, 3, 3 ]
29+
> var bool = ( out === x )
30+
true
31+
32+
See Also
33+
--------
34+

0 commit comments

Comments
 (0)