Skip to content

Commit 2d26f29

Browse files
Merge branch 'stdlib-js:develop' into develop
2 parents c77a2fd + b9d0c57 commit 2d26f29

File tree

275 files changed

+11805
-2433
lines changed

Some content is hidden

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

275 files changed

+11805
-2433
lines changed

.github/labeler.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
BLAS:
2020
- changed-files:
21-
- any-glob-to-any-file: '**/blas/**/*'
21+
- any-glob-to-all-files: '**/blas/**/*'
2222

2323
Math:
2424
- changed-files:
25-
- any-glob-to-any-file: '**/math/**/*'
25+
- any-glob-to-all-files: '**/math/**/*'

.github/workflows/labeler.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ jobs:
3232
# Define job name:
3333
name: 'Labeler'
3434

35+
# Only run this job if the pull request did not have label `automated-pr`:
36+
if: contains(github.event.pull_request.labels.*.name, 'automated-pr') == false
37+
3538
# Define job permissions:
3639
permissions:
3740
contents: read

.github/workflows/lint_random_files.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ jobs:
316316
# Pin action to full length commit SHA
317317
uses: r-lib/actions/setup-r@0ed4cdf40958ef43a6b33b9792e07ac76c3239e3 # v2.6.4
318318
with:
319-
r-version: '3.5.3'
319+
r-version: '4.3.3'
320320

321321
# Lint R files:
322322
- name: 'Lint R files'

.github/workflows/namespace_exports.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@ name: namespace_exports
2121

2222
# Workflow triggers:
2323
on:
24-
pull_request_target:
25-
branches:
26-
- develop
27-
types:
28-
- closed
29-
3024
# Allow the workflow to be manually run:
3125
workflow_dispatch:
3226

CONTRIBUTING.md

Lines changed: 56 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,17 @@ Create a [GitHub account][github-signup]. The project uses GitHub exclusively fo
118118
$ git clone https://github.com/<username>/stdlib.git
119119
```
120120

121-
where `<username>` is your GitHub username. The repository has a large commit history, leading to slow download times. You can reduce the download time by limiting the clone [depth][git-clone-depth].
121+
where `<username>` is your GitHub username. When cloning, avoid cloning to a directory having spaces in its path. Because this project relies heavily on `make`, any spaces in the directory path will lead to errors and inevitable frustration.
122+
123+
```text
124+
// Bad:
125+
/home/foo/bar/beep boop/stdlib
126+
127+
// Good:
128+
/home/foo/bar/beep_boop/stdlib
129+
```
130+
131+
The repository has a large commit history, leading to slow download times. You can reduce the download time by limiting the clone [depth][git-clone-depth].
122132

123133
<!-- run-disable -->
124134

@@ -152,7 +162,27 @@ And finally, add an `upstream` [remote][git-remotes] to allow syncing changes be
152162
$ git remote add upstream git://github.com/stdlib-js/stdlib.git
153163
```
154164

155-
#### Step 2: Branch
165+
#### Step 2: Initial Setup
166+
167+
Install dependencies.
168+
169+
<!-- run-disable -->
170+
171+
```bash
172+
$ make install
173+
```
174+
175+
Initialize Git hooks to enable automated development processes to run prior to authoring commits and pushing changes.
176+
177+
<!-- run-disable -->
178+
179+
```bash
180+
$ make init
181+
```
182+
183+
Note that `make init` only needs to be run once; however, we repeat it below as **not** running it is a common omission by new contributors.
184+
185+
#### Step 3: Branch
156186

157187
For modifications intended to be included in stdlib, create a new local branch.
158188

@@ -164,11 +194,11 @@ $ git checkout -b <branch>
164194

165195
where `<branch>` is the branch name. Both the `master` and `develop` branches for the main stdlib project are protected, and direct modifications to these branches will **not** be accepted. Instead, all contributions should be made on non-master and non-develop local branches, including documentation changes and other non-code modifications. See the project [branching guide][stdlib-branching] for additional guidance.
166196

167-
#### Step 3: Write
197+
#### Step 4: Write
168198

169199
Start making your changes and/or implementing the new feature. Any text you write should follow the [text style guide][stdlib-style-guides-text], including comments and API documentation.
170200

171-
#### Step 4: Commit
201+
#### Step 5: Commit
172202

173203
Ensure that you have configured [Git][git] to know your name and email address.
174204

@@ -190,7 +220,7 @@ $ git commit
190220

191221
When writing commit messages, follow the Git [style guide][stdlib-style-guides-git]. Adherence to project commit conventions is necessary for project automation which automatically generates release notes and changelogs from commit messages.
192222

193-
#### Step 5: Sync
223+
#### Step 6: Sync
194224

195225
To incorporate recent changes from the `upstream` repository during development, you should [rebase][git-rebase] your local branch, reapplying your local commits on top of the current upstream `HEAD`. This procedure is in contrast to performing a standard [merge][git-merge], which may interleave development histories. The rationale is twofold:
196226

@@ -206,11 +236,13 @@ $ git fetch upstream
206236
$ git rebase upstream/develop
207237
```
208238

209-
#### Step 6: Test
239+
#### Step 7: Test
210240

211241
Tests should accompany **all** bug fixes and features. For guidance on how to write tests, consult existing tests within the project.
212242

213-
**Before** submitting a [pull request][github-pull-request] to the `upstream` repository, ensure that all tests pass, including linting. If [Git][git] hooks have been enabled,
243+
**Before** submitting a [pull request][github-pull-request] to the `upstream` repository, ensure that all tests pass, including linting. To run tests locally, consult the guidance [below](#writing-tests).
244+
245+
If [Git][git] hooks have been enabled,
214246

215247
<!-- run-disable -->
216248

@@ -222,7 +254,7 @@ linting should be automatically triggered prior to each commit, and test executi
222254

223255
Any [pull requests][github-pull-request] which include failing tests and/or lint errors will **not** be accepted.
224256

225-
#### Step 7: Push
257+
#### Step 8: Push
226258

227259
Push your changes to your remote GitHub repository.
228260

@@ -234,7 +266,7 @@ $ git push origin <branch>
234266

235267
where `<branch>` is the name of your branch.
236268

237-
#### Step 8: Pull Request
269+
#### Step 9: Pull Request
238270

239271
Once your contribution is ready to be incorporated in the `upstream` repository, open a [pull request][github-pull-request] against the `develop` branch. One or more project contributors will review the contribution, provide feedback, and potentially request changes.
240272

@@ -280,13 +312,13 @@ $ git commit -m "fixup! feat: add support for computing the absolute value"
280312

281313
If the history needs modification, a contributor will modify the history during the merge process. The rationale for **not** rewriting public history is that doing so invalidates the commit history for anyone else who has pulled your changes, thus imposing additional burdens on collaborators to ensure that their local versions match the modified history.
282314

283-
#### Step 9: Land
315+
#### Step 10: Land
284316

285317
After any changes have been resolved and continuous integration tests have passed, a contributor will approve a [pull request][github-pull-request] for inclusion in the project. Once merged, the [pull request][github-pull-request] will be updated with the merge commit, and the [pull request][github-pull-request] will be closed.
286318

287319
Note that, during the merge process, multiple commits will often be [squashed][git-rewriting-history].
288320

289-
#### Step 10: Celebrate
321+
#### Step 11: Celebrate
290322

291323
**Congratulations**! You are an official contributor to stdlib! Thank you for your hard work and patience!
292324

@@ -316,15 +348,15 @@ The project can **never** have enough tests. To address areas lacking sufficient
316348
<!-- run-disable -->
317349

318350
```bash
319-
$ make TESTS_FILTER=.*/<pattern>/.* test
351+
$ make TESTS_FILTER=".*/<pattern>/.*" test
320352
```
321353

322354
where `<pattern>` is a pattern matching a particular path. For example, to test the base math `sin` package
323355

324356
<!-- run-disable -->
325357

326358
```bash
327-
$ make TESTS_FILTER=.*/math/base/special/sin/.* test
359+
$ make TESTS_FILTER=".*/math/base/special/sin/.*" test
328360
```
329361

330362
where the pattern `.*/math/base/special/sin/.*` matches any test file whose absolute path contains `math/base/special/sin`.
@@ -334,14 +366,24 @@ The project can **never** have enough tests. To address areas lacking sufficient
334366
<!-- run-disable -->
335367

336368
```bash
337-
$ make TESTS_FILTER=.*/<pattern>/.* test-cov
369+
$ make TESTS_FILTER=".*/<pattern>/.*" test-cov
338370
$ make view-cov
339371
```
340372

341373
which opens the coverage report in your default web browser.
342374

343375
7. Submit the test as a [pull request][github-pull-request].
344376

377+
Note that, for contributions targeting C implementations, you'll need to first compile the native add-on which provides the bridge between JavaScript and C (assuming that the package has a native add-on binding).
378+
379+
```bash
380+
$ make install-node-addons NODE_ADDONS_PATTERN="math/base/special/sin"
381+
```
382+
383+
where the pattern `math/base/special/sin` (note the differences from the filter pattern above!) matches any add-on whose absolute path contains `math/base/special/sin`.
384+
385+
Once the add-on is compiled, you can follow steps 5-7 above.
386+
345387
### Writing Documentation
346388
347389
> By contributing documentation to the project, you are agreeing to release it under the project [license][stdlib-license].

CONTRIBUTORS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Anudeep Sanapala <[email protected]>
1212
Athan Reines <[email protected]>
1313
Brendan Graetz <[email protected]>
1414
Bruno Fenzl <[email protected]>
15+
Bryan Elee <[email protected]>
1516
Chinmay Joshi <[email protected]>
1617
Christopher Dambamuromo <[email protected]>
1718
@@ -27,6 +28,7 @@ Jaimin Godhani <[email protected]>
2728
James Gelok <[email protected]>
2829
Jaysukh Makvana <[email protected]>
2930
Jithin KS <[email protected]>
31+
Joel Mathew Koshy <[email protected]>
3032
Joey Reed <[email protected]>
3133
Jordan Gallivan <[email protected]>
3234
Joris Labie <[email protected]>

lib/node_modules/@stdlib/array/base/docs/types/index.d.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ import cartesianSquare = require( '@stdlib/array/base/cartesian-square' );
6464
import copy = require( '@stdlib/array/base/copy' );
6565
import copyIndexed = require( '@stdlib/array/base/copy-indexed' );
6666
import countFalsy = require( '@stdlib/array/base/count-falsy' );
67+
import countSameValue = require( '@stdlib/array/base/count-same-value' );
68+
import countSameValueZero = require( '@stdlib/array/base/count-same-value-zero' );
6769
import countTruthy = require( '@stdlib/array/base/count-truthy' );
6870
import dedupe = require( '@stdlib/array/base/dedupe' );
6971
import every = require( '@stdlib/array/base/every' );
@@ -1340,6 +1342,47 @@ interface Namespace {
13401342
*/
13411343
countFalsy: typeof countFalsy;
13421344

1345+
/**
1346+
* Counts the number of elements in an array that are equal to a specified value.
1347+
*
1348+
* ## Notes
1349+
*
1350+
* - The function uses the [SameValue Algorithm][ecma-262-same-value-algorithm], as specified in ECMAScript 5.
1351+
* - In contrast to the strict equality operator `===`, `-0` and `+0` are distinguishable and `NaNs` are the same.
1352+
*
1353+
* [ecma-262-same-value-algorithm]: http://ecma-international.org/ecma-262/5.1/#sec-9.12
1354+
*
1355+
* @param x - input array
1356+
* @param value - search value
1357+
* @returns number of elements that are equal to a specified value
1358+
*
1359+
* @example
1360+
* var x = [ 0, 1, 0, 1, 1 ];
1361+
*
1362+
* var out = ns.countSameValue( x, 1 );
1363+
* // returns 3
1364+
*/
1365+
countSameValue: typeof countSameValue;
1366+
1367+
/**
1368+
* Counts the number of elements in an array that are equal to a specified value.
1369+
*
1370+
* ## Notes
1371+
*
1372+
* - In contrast to an implementation based on the strict equality operator `===`, the function treats `NaNs` as the same value.
1373+
*
1374+
* @param x - input array
1375+
* @param value - search value
1376+
* @returns number of elements that are equal to a specified value
1377+
*
1378+
* @example
1379+
* var x = [ 0, 1, 0, 1, 1 ];
1380+
*
1381+
* var out = ns.countSameValueZero( x, 1 );
1382+
* // returns 3
1383+
*/
1384+
countSameValueZero: typeof countSameValueZero;
1385+
13431386
/**
13441387
* Counts the number of truthy values in an array.
13451388
*

lib/node_modules/@stdlib/assert/docs/types/index.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ import isNonConfigurableProperty = require( '@stdlib/assert/is-nonconfigurable-p
206206
import isNonConfigurablePropertyIn = require( '@stdlib/assert/is-nonconfigurable-property-in' );
207207
import isNonEnumerableProperty = require( '@stdlib/assert/is-nonenumerable-property' );
208208
import isNonEnumerablePropertyIn = require( '@stdlib/assert/is-nonenumerable-property-in' );
209+
import isNonNegativeFinite = require( '@stdlib/assert/is-nonnegative-finite' );
209210
import isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' );
210211
import isNonNegativeIntegerArray = require( '@stdlib/assert/is-nonnegative-integer-array' );
211212
import isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-number' );
@@ -4336,6 +4337,8 @@ interface Namespace {
43364337
*/
43374338
isNonEnumerablePropertyIn: typeof isNonEnumerablePropertyIn;
43384339

4340+
isNonNegativeFinite: typeof isNonNegativeFinite;
4341+
43394342
/**
43404343
* Tests if a value is a nonnegative integer.
43414344
*

0 commit comments

Comments
 (0)