Skip to content

Commit 8dff2cb

Browse files
authored
Merge branch 'stdlib-js:develop' into ndarray-base-shift
2 parents f0ec0b4 + 91b52d8 commit 8dff2cb

File tree

245 files changed

+36195
-881
lines changed

Some content is hidden

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

245 files changed

+36195
-881
lines changed

.github/workflows/namespace_declarations.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,11 @@ jobs:
6565
# Specify whether to download Git-LFS files:
6666
lfs: false
6767

68-
# Avoid storing GitHub token in local Git configuration:
69-
persist-credentials: false
68+
# Provide a GitHub token for authentication
69+
token: ${{ secrets.STDLIB_BOT_PAT_REPO_WRITE }}
70+
71+
# Store GitHub token in local Git configuration:
72+
persist-credentials: true
7073
timeout-minutes: 10
7174

7275
# Install Node.js:
@@ -107,7 +110,20 @@ jobs:
107110
# Process each namespace:
108111
while IFS= read -r namespace; do
109112
if [ -n "$namespace" ] && [[ $namespace != *"_tools"* ]]; then
110-
branch_name="update-$(echo "$namespace" | sed 's/@stdlib\///' | sed 's/\//-/g')-declarations"
113+
# Namespace without the '@stdlib/' scope for display in commit messages and PR titles:
114+
display_namespace="${namespace#@stdlib/}"
115+
116+
# Branch name slug with slashes replaced by dashes:
117+
branch_name="update-${display_namespace//\//-}-declarations"
118+
119+
# If an open PR already exists for this branch, skip this namespace entirely:
120+
existing_pr=$(gh pr list --head "$branch_name" --state open --json number -q '.[0].number' || true)
121+
if [ -n "$existing_pr" ]; then
122+
echo "Open PR exists for $branch_name (#$existing_pr). Skipping $namespace."
123+
continue
124+
fi
125+
126+
# Switch to the new branch:
111127
git checkout -b "$branch_name"
112128
113129
# Generate declarations for this namespace:
@@ -119,13 +135,13 @@ jobs:
119135
git add lib/node_modules/@stdlib
120136
121137
# Commit changes:
122-
git commit -m "feat: update \`${namespace}\` TypeScript declarations" --signoff
138+
git commit -m "feat: update \`${display_namespace}\` TypeScript declarations" --signoff
123139
124140
# Push branch and create PR:
125141
git push origin "$branch_name"
126142
127143
gh pr create \
128-
--title "feat: update \`${namespace}\` TypeScript declarations" \
144+
--title "feat: update \`${display_namespace}\` TypeScript declarations" \
129145
--body "This PR updates TypeScript declarations for the \`${namespace}\` namespace.
130146
131147
## Reviewer Checklist
@@ -138,7 +154,7 @@ jobs:
138154
- [ ] Approve the PR once you are confident about the classification and changes made." \
139155
--label "Documentation" \
140156
--label "automated-pr" \
141-
--reviewer "reviewers" \
157+
--reviewer "@stdlib-js/reviewers" \
142158
--base develop \
143159
--head "$branch_name"
144160
fi

lib/node_modules/@stdlib/_tools/eslint/rules/jsdoc-leading-description-sentence/test/fixtures/invalid.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,9 @@ test = {
212212
'',
213213
'var ctors = require( "./main.js" );'
214214
].join( '\n' ),
215-
'options': [ {
215+
'options': [{
216216
'whitelist': [ 'ndarray' ]
217-
} ],
217+
}],
218218
'errors': [
219219
{
220220
'message': 'Description must start with an uppercase letter or number and end with a period',

lib/node_modules/@stdlib/_tools/github/create-repo/lib/factory.js

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -95,21 +95,22 @@ function factory( options, clbk ) {
9595
throw new TypeError( format( 'invalid argument. Repository name must be a string. Value: `%s`.', name ) );
9696
}
9797
query( name, opts, done );
98-
/**
99-
* Callback invoked after receiving an API response.
100-
*
101-
* @private
102-
* @param {(Error|null)} error - error object
103-
* @param {ObjectArray} data - query data
104-
* @param {Object} info - response info
105-
* @returns {void}
106-
*/
107-
function done( error, data, info ) {
108-
error = error || null;
109-
data = data || null;
110-
info = info || null;
111-
clbk( error, data, info );
112-
}
98+
}
99+
100+
/**
101+
* Callback invoked after receiving an API response.
102+
*
103+
* @private
104+
* @param {(Error|null)} error - error object
105+
* @param {ObjectArray} data - query data
106+
* @param {Object} info - response info
107+
* @returns {void}
108+
*/
109+
function done( error, data, info ) {
110+
error = error || null;
111+
data = data || null;
112+
info = info || null;
113+
clbk( error, data, info );
113114
}
114115
}
115116

lib/node_modules/@stdlib/_tools/remark/plugins/remark-run-javascript-examples/lib/main.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
* limitations under the License.
1717
*/
1818

19+
/* eslint-disable stdlib/jsdoc-example-require-spacing */
20+
1921
'use strict';
2022

2123
// MODULES //
@@ -77,8 +79,8 @@ var runner = require( './runner.js' );
7779
* ''
7880
* ];
7981
*
80-
* remark().use( run ).process( str.join( '\n' ), done );
81-
* // => 'HELLO WORLD'
82+
* remark().use( attacher ).process( str.join( '\n' ), done );
83+
* // e.g., => 'HELLO WORLD!'
8284
*
8385
* function done( error ) {
8486
* if ( error ) {

lib/node_modules/@stdlib/_tools/scripts/create_namespace_types.js

Lines changed: 61 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* limitations under the License.
1919
*/
2020

21-
/* eslint-disable node/no-sync, no-console */
21+
/* eslint-disable node/no-sync, no-console, max-statements */
2222

2323
'use strict';
2424

@@ -44,6 +44,54 @@ var RE_TS_EXPORT = /export = ([^;]+);/;
4444
var RE_EXAMPLE = /@example[\s\S]*?(?=@example|\*\/)/g;
4545
var RE_NAMESPACE = /@namespace ([a-z.0-9]+)/i;
4646
var RE_COPYRIGHT_YEAR = /Copyright \(c\) (\d{4}) The Stdlib Authors\./;
47+
var RESERVED_WORDS = [
48+
'break',
49+
'case',
50+
'catch',
51+
'class',
52+
'const',
53+
'continue',
54+
'debugger',
55+
'default',
56+
'delete',
57+
'do',
58+
'else',
59+
'export',
60+
'extends',
61+
'false',
62+
'finally',
63+
'for',
64+
'function',
65+
'if',
66+
'import',
67+
'in',
68+
'instanceof',
69+
'new',
70+
'null',
71+
'return',
72+
'super',
73+
'switch',
74+
'this',
75+
'throw',
76+
'true',
77+
'try',
78+
'typeof',
79+
'var',
80+
'void',
81+
'while',
82+
'with',
83+
'let',
84+
'static',
85+
'yield',
86+
'await',
87+
'enum',
88+
'implements',
89+
'interface',
90+
'package',
91+
'private',
92+
'protected',
93+
'public'
94+
];
4795

4896

4997
// FUNCTIONS //
@@ -175,6 +223,7 @@ function create( fullPath ) {
175223
var tsDefPath;
176224
var testFile;
177225
var typesDir;
226+
var safeName;
178227
var defFile;
179228
var pkgPath;
180229
var match;
@@ -237,11 +286,16 @@ function create( fullPath ) {
237286
}
238287
while ( match !== null ) {
239288
name = match[ 1 ];
289+
if ( contains( RESERVED_WORDS, name ) ) {
290+
safeName = '_' + name;
291+
} else {
292+
safeName = name;
293+
}
240294
pkgPath = match[ 2 ];
241295

242296
tsDefPath = replace( require.resolve( pkgPath ), 'lib/index.js', 'docs/types/index.d.ts' );
243297
if ( fs.existsSync( tsDefPath ) ) {
244-
stmt = replace( IMPORT_STATEMENT, '<name>', name );
298+
stmt = replace( IMPORT_STATEMENT, '<name>', safeName );
245299
stmt = replace( stmt, '<path>', pkgPath );
246300
importStmts.push( stmt );
247301

@@ -253,7 +307,7 @@ function create( fullPath ) {
253307
if ( !tsDoc ) {
254308
tsDoc = tsDef.match( /(\/\*\*\n[^/]+?\*\/)\ndeclare class/ );
255309
}
256-
prop = '\t'+name+': typeof '+name+';';
310+
prop = '\t'+name+': typeof '+safeName+';';
257311
if ( tsDoc && tsDoc[ 1 ] ) {
258312
str = tsDoc[ 1 ];
259313
str = replace( str, RE_EXAMPLE, onReplace );
@@ -301,8 +355,10 @@ function create( fullPath ) {
301355
var RE;
302356

303357
match = replace( match, mainExport[ 1 ], name );
304-
RE = new RegExp( '([^a-zA-Z@])'+name, 'g' );
305-
return replace( match, RE, '$1ns.'+name );
358+
359+
// Only match the standalone identifier `name`:
360+
RE = new RegExp( '(^|[^a-zA-Z0-9_@])' + name + '(?![a-zA-Z0-9_])', 'g' );
361+
return replace( match, RE, '$1ns.' + name );
306362
}
307363
}
308364

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
/* eslint-disable max-lines */
2222

2323
import contains = require( '@stdlib/array/base/assert/contains' );
24+
import hasAlmostEqualValues = require( '@stdlib/array/base/assert/has-almost-equal-values' );
2425
import hasEqualValues = require( '@stdlib/array/base/assert/has-equal-values' );
2526
import hasEqualValuesIndexed = require( '@stdlib/array/base/assert/has-equal-values-indexed' );
2627
import hasSameValues = require( '@stdlib/array/base/assert/has-same-values' );
@@ -73,6 +74,27 @@ interface Namespace {
7374
*/
7475
contains: typeof contains;
7576

77+
/**
78+
* Tests if two arrays have respective elements which are approximately equal within a specified number of ULPs (units in the last place).
79+
*
80+
* ## Notes
81+
*
82+
* - If provided arrays of unequal length, the function returns `false`.
83+
*
84+
* @param x - first input array
85+
* @param y - second input array
86+
* @param maxULP - maximum allowed ULP difference
87+
* @returns boolean indicating whether both arrays are approximately equal
88+
*
89+
* @example
90+
* var x = [ 0, 0, 1, 0 ];
91+
* var y = [ 0, 0, 1, 0 ];
92+
*
93+
* var out = ns.hasAlmostEqualValues( x, y, 0 );
94+
* // returns true
95+
*/
96+
hasAlmostEqualValues: typeof hasAlmostEqualValues;
97+
7698
/**
7799
* Tests if two arrays have equal values.
78100
*

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

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,63 @@
2121
/* eslint-disable max-lines */
2222

2323
import filled2dBy = require( '@stdlib/array/base/banded/filled2d-by' );
24+
import toCompact = require( '@stdlib/array/base/banded/to-compact' );
2425

2526
/**
26-
* Interface describing a namespace.
27+
* Interface describing the `banded` namespace.
2728
*/
2829
interface Namespace {
2930
/**
30-
* TODO
31+
* Returns a filled two-dimensional banded nested array according to a provided callback function.
32+
*
33+
* @param shape - array shape
34+
* @param ku - number of super-diagonals
35+
* @param kl - number of sub-diagonals
36+
* @param fill - fill value for values outside the band
37+
* @param clbk - callback function
38+
* @param thisArg - callback function execution context
39+
* @returns output array
40+
*
41+
* @example
42+
* function clbk( indices ) {
43+
* return indices[ 0 ] + indices[ 1 ];
44+
* }
45+
*
46+
* var out = ns.filled2dBy( [ 3, 3 ], 1, 1, 0, clbk );
47+
* // returns [ [ 0, 1, 0 ], [ 1, 2, 3 ], [ 0, 3, 4 ] ]
3148
*/
3249
filled2dBy: typeof filled2dBy;
50+
51+
/**
52+
* Converts a two-dimensional banded nested array to compact banded storage.
53+
*
54+
* @param arr - input two-dimensional array
55+
* @param ku - number of super-diagonals
56+
* @param kl - number of sub-diagonals
57+
* @param colexicographic - specifies whether to store diagonals in colexicographic access order
58+
* @returns output array
59+
*
60+
* @example
61+
* var M = [
62+
* [ 11, 2, 0 ],
63+
* [ 3, 12, 4 ],
64+
* [ 0, 5, 13 ]
65+
* ];
66+
*
67+
* var out = ns.toCompact( M, 1, 1, false );
68+
* // returns [ [ 0, 2, 4 ], [ 11, 12, 13 ], [ 3, 5, 0 ] ]
69+
*
70+
* @example
71+
* var M = [
72+
* [ 11, 2, 0 ],
73+
* [ 3, 12, 4 ],
74+
* [ 0, 5, 13 ]
75+
* ];
76+
*
77+
* var out = ns.toCompact( M, 1, 1, true );
78+
* // returns [ [ 0, 11, 3 ], [ 2, 12, 5 ], [ 4, 13, 0 ] ]
79+
*/
80+
toCompact: typeof toCompact;
3381
}
3482

3583
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ type Results<T> = [ Array<[ number, T ]>, Array<[ number, T ]> ];
3838
* var x = [ 'beep', 'boop', 'foo', 'bar' ];
3939
* var filter = [ true, true, false, true ];
4040
*
41-
* var out = bifurcateEntries( arr, filter );
41+
* var out = bifurcateEntries( x, filter );
4242
* // returns [ [ [ 0, 'beep' ], [ 1, 'boop' ], [ 3, 'bar' ] ], [ [ 2, 'foo' ] ] ]
4343
*/
4444
declare function bifurcateEntries<T = unknown>( x: Collection<T> | AccessorArrayLike<T>, filter: Collection | AccessorArrayLike<any> ): Results<T>; // eslint-disable-line @typescript-eslint/no-explicit-any

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import { Collection, AccessorArrayLike } from '@stdlib/types/array';
3333
* var x = [ 'beep', 'boop', 'foo', 'bar' ];
3434
* var filter = [ true, true, false, true ];
3535
*
36-
* var out = bifurcateValues( arr, filter );
36+
* var out = bifurcateValues( x, filter );
3737
* // returns [ [ 'beep', 'boop', 'bar' ], [ 'foo' ] ]
3838
*/
3939
declare function bifurcateValues<T = unknown>( x: Collection<T> | AccessorArrayLike<T>, filter: Collection | AccessorArrayLike<any> ): [ Array<T>, Array<T> ]; // eslint-disable-line @typescript-eslint/no-explicit-any

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ type InOutShapes = [
8888
* var ones5d = require( '@stdlib/array/base/ones5d' );
8989
* var zeros5d = require( '@stdlib/array/base/zeros5d' );
9090
* var add = require( '@stdlib/number/float64/base/add3' );
91-
* var bternary5d = require( '@stdlib/array/base/broadcasted-ternary5d' );
9291
* var shapes = [
9392
* [ 1, 2, 1, 1, 1 ],
9493
* [ 2, 1, 1, 1, 1 ],

0 commit comments

Comments
 (0)