Skip to content

Commit 1745404

Browse files
committed
Merge branch 'develop' of https://github.com/stdlib-js/stdlib into develop
2 parents 09ffebd + 6c64208 commit 1745404

File tree

31 files changed

+1862
-83
lines changed

31 files changed

+1862
-83
lines changed

lib/node_modules/@stdlib/_tools/changelog/generate/lib/breaking_changes.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ function formatBreakingChange( note ) {
5858
var hash = trim( note.hash );
5959
var out = '- [`'+hash.substring( 0, 7 )+'`]('+STDLIB_GITHUB_URL+'/'+hash+'): '+parts[ 0 ];
6060
if ( parts.length > 1 ) {
61-
out +=' \n\n';
61+
out +='\n\n';
6262
out += ' - ';
63-
out += parts.slice( 1 ).join( '\n ' );
63+
out += parts.slice( 1 ).join( '\n ' );
6464
out += '\n';
6565
}
6666
return out;

lib/node_modules/@stdlib/_tools/changelog/generate/lib/closed_issues.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
// MODULES //
2222

23+
var contains = require( '@stdlib/assert/contains' );
24+
var isDigitString = require( '@stdlib/assert/is-digit-string' );
2325
var filter = require( '@stdlib/array/base/filter' );
2426
var map = require( '@stdlib/utils/map' );
2527
var collectField = require( './collect_field.js' );
@@ -28,6 +30,11 @@ var sectionEnd = require( './section_end.js' );
2830
var heading = require( './heading.js' );
2931

3032

33+
// VARIABLES //
34+
35+
var VERBS = [ 'Closes', 'Fixes', 'Resolves' ];
36+
37+
3138
// FUNCTIONS //
3239

3340
/**
@@ -38,7 +45,7 @@ var heading = require( './heading.js' );
3845
* @returns {boolean} boolean indicating whether a mention references closing an issue
3946
*/
4047
function isClosingIssue( mention ) {
41-
return mention.action === 'Closes' || mention.action === 'Fixes' || mention.action === 'Resolves';
48+
return contains( VERBS, mention.action ) && isDigitString( mention.ref );
4249
}
4350

4451
/**
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[
2-
"stdlib-bot <[email protected]>"
2+
"dependabot[bot]",
3+
"stdlib-bot"
34
]

lib/node_modules/@stdlib/_tools/changelog/generate/lib/format_contributors.js

+16-10
Original file line numberDiff line numberDiff line change
@@ -46,27 +46,33 @@ var RE_CO_AUTHORED_BY = /co-authored-by/i;
4646
function extractContributors( commits ) {
4747
var mentions;
4848
var mention;
49+
var author;
4950
var out;
5051
var i;
5152
var j;
5253

5354
out = [];
5455
for ( i = 0; i < commits.length; i++ ) {
56+
author = replace( commits[ i ].author, /\s*<[^>]+>\s*/, '' );
5557
if (
56-
!contains( out, commits[ i ].author ) &&
57-
!contains( EXCLUDED_CONTRIBUTORS, commits[ i ].author )
58+
!contains( out, author ) &&
59+
!contains( EXCLUDED_CONTRIBUTORS, author )
5860
) {
59-
out.push( commits[ i ].author );
61+
out.push( author );
6062
}
6163
mentions = commits[ i ].mentions || [];
6264
for ( j = 0; j < mentions.length; j++ ) {
6365
mention = mentions[ j ];
6466
if (
65-
RE_CO_AUTHORED_BY.test( mention.action ) &&
66-
!contains( out, mention.ref ) &&
67-
!contains( EXCLUDED_CONTRIBUTORS, mention.ref )
67+
RE_CO_AUTHORED_BY.test( mention.action )
6868
) {
69-
out.push( mention.ref );
69+
author = replace( mention.ref, /\s*<[^>]+>\s*/, '' );
70+
if (
71+
!contains( out, author ) &&
72+
!contains( EXCLUDED_CONTRIBUTORS, author )
73+
) {
74+
out.push( author );
75+
}
7076
}
7177
}
7278
}
@@ -77,15 +83,15 @@ function extractContributors( commits ) {
7783
* Formats a contributor.
7884
*
7985
* @private
80-
* @param {string} contributor - contributor
86+
* @param {string} contributor - contributor name
8187
* @returns {string} formatted contributor
8288
*
8389
* @example
84-
* var out = formatContributor( 'Jane Doe <[email protected]>' );
90+
* var out = formatContributor( 'Jane Doe' );
8591
* // returns '- Jane Doe'
8692
*/
8793
function formatContributor( contributor ) {
88-
return '- ' + replace( contributor, /\s*<[^>]+>\s*/, '' );
94+
return '- ' + contributor;
8995
}
9096

9197

lib/node_modules/@stdlib/_tools/changelog/generate/lib/main.js

+39-33
Original file line numberDiff line numberDiff line change
@@ -318,22 +318,26 @@ function generate( pkg, releaseType ) {
318318
if ( isNamespacePkg ) {
319319
str += releaseSectionStart( nextVersion );
320320
str += '## ' + ( nextVersion || 'Unreleased' ) + ' (' + formatDate() + ')\n\n';
321-
bySubpackage = groupBySubPackage( commits.unreleased, pkg );
322-
pkgNames = objectKeys( bySubpackage ).sort();
323-
str += sectionStart( 'packages' );
324-
str += heading( 'Packages', 3 );
325-
for ( i = 0; i < pkgNames.length; i++ ) {
326-
name = pkgNames[ i ];
327-
unreleased = releaseSummary( bySubpackage[ name ], true, true );
328-
if ( unreleased || nextVersion ) {
329-
str += packageSummaryWrapper( pkg, '', name, unreleased || PLACEHOLDER_SUMMARY );
321+
if ( commits.unreleased.length > 0 ) {
322+
bySubpackage = groupBySubPackage( commits.unreleased, pkg );
323+
pkgNames = objectKeys( bySubpackage ).sort();
324+
str += sectionStart( 'packages' );
325+
str += heading( 'Packages', 3 );
326+
for ( i = 0; i < pkgNames.length; i++ ) {
327+
name = pkgNames[ i ];
328+
unreleased = releaseSummary( bySubpackage[ name ], true, true );
329+
if ( unreleased ) {
330+
str += packageSummaryWrapper( pkg, '', name, unreleased );
331+
}
330332
}
333+
str += sectionEnd( 'packages' );
334+
str += breakingChanges( commits.unreleased );
335+
str += closedIssues( commits.unreleased );
336+
str += formatContributors( commits.unreleased );
337+
str += formatCommits( commits.unreleased );
338+
} else {
339+
str += PLACEHOLDER_SUMMARY;
331340
}
332-
str += sectionEnd( 'packages' );
333-
str += breakingChanges( commits.unreleased );
334-
str += closedIssues( commits.unreleased );
335-
str += formatContributors( commits.unreleased );
336-
str += formatCommits( commits.unreleased );
337341
str += sectionEnd( 'release' );
338342
} else {
339343
unreleased = releaseSummary( commits.unreleased );
@@ -347,28 +351,30 @@ function generate( pkg, releaseType ) {
347351
if ( isNamespacePkg ) {
348352
for ( i = releases.length-1; i >= 0; i-- ) {
349353
version = releases[ i ][ 0 ];
350-
releaseCommits = commits[ version ];
351-
if ( !releaseCommits ) {
352-
releaseCommits = [];
353-
}
354+
str += releaseSectionStart( version );
354355
str += '## ' + version + ' (' + formatDate( releases[ i ][ 1 ] ) + ')\n\n';
355-
bySubpackage = groupBySubPackage( releaseCommits, pkg );
356-
pkgNames = objectKeys( bySubpackage ).sort();
357-
str += sectionStart( 'packages' );
358-
str += heading( 'Packages', 3 );
359-
for ( j = 0; j < pkgNames.length; j++ ) {
360-
name = pkgNames[ j ];
361-
summary = releaseSummary( bySubpackage[ name ], true, true );
362-
if ( !summary ) {
363-
summary = PLACEHOLDER_SUMMARY;
356+
releaseCommits = commits[ version ];
357+
if ( releaseCommits && releaseCommits.length > 0 ) {
358+
bySubpackage = groupBySubPackage( releaseCommits, pkg );
359+
pkgNames = objectKeys( bySubpackage ).sort();
360+
str += sectionStart( 'packages' );
361+
str += heading( 'Packages', 3 );
362+
for ( j = 0; j < pkgNames.length; j++ ) {
363+
name = pkgNames[ j ];
364+
summary = releaseSummary( bySubpackage[ name ], true, true );
365+
if ( summary ) {
366+
str += packageSummaryWrapper( pkg, version, name, summary );
367+
}
364368
}
365-
str += packageSummaryWrapper( pkg, version, name, summary );
369+
str += sectionEnd( 'packages' );
370+
str += breakingChanges( releaseCommits );
371+
str += closedIssues( releaseCommits );
372+
str += formatContributors( releaseCommits );
373+
str += formatCommits( releaseCommits );
374+
} else {
375+
str += PLACEHOLDER_SUMMARY;
366376
}
367-
str += sectionEnd( 'packages' );
368-
str += breakingChanges( releaseCommits );
369-
str += closedIssues( releaseCommits );
370-
str += formatContributors( releaseCommits );
371-
str += formatCommits( releaseCommits );
377+
str += sectionEnd( 'release' );
372378
}
373379
} else {
374380
for ( i = releases.length-1; i >= 0; i-- ) {

lib/node_modules/@stdlib/_tools/changelog/parse-commits/lib/conventional_changelog.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ var RE_LEADING_HASH = /^\s*#/;
4747
* @returns {Object} conventional changelog format
4848
*/
4949
function toConventionalChangelog( ast, options ) {
50+
var breakingChanges = [];
5051
var out = {
5152
'type': '',
5253
'scope': null,
@@ -64,6 +65,10 @@ function toConventionalChangelog( ast, options ) {
6465
visitWithAncestors( ast, [ 'breaking-change' ], processBreakingChanges );
6566
visit( ast, 'footer', processFooter );
6667

68+
// Only keep the last breaking change note:
69+
if ( breakingChanges.length > 0 ) {
70+
out.notes.push( breakingChanges[ breakingChanges.length-1 ] );
71+
}
6772
return out;
6873

6974
/**
@@ -96,7 +101,7 @@ function toConventionalChangelog( ast, options ) {
96101
break;
97102
}
98103
if ( breaking.text !== '' ) {
99-
out.notes.push( breaking );
104+
breakingChanges.push( breaking );
100105
}
101106

102107
/**

lib/node_modules/@stdlib/math/base/special/besselj0/README.md

+88
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,94 @@ for ( i = 0; i < 100; i++ ) {
9999

100100
<!-- /.examples -->
101101

102+
<!-- C interface documentation. -->
103+
104+
* * *
105+
106+
<section class="c">
107+
108+
## C APIs
109+
110+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
111+
112+
<section class="intro">
113+
114+
</section>
115+
116+
<!-- /.intro -->
117+
118+
<!-- C usage documentation. -->
119+
120+
<section class="usage">
121+
122+
### Usage
123+
124+
```c
125+
#include "stdlib/math/base/special/besselj0.h"
126+
```
127+
128+
#### stdlib_base_besselj0( x )
129+
130+
Computes the [Bessel function of the first kind][bessel-first-kind] of order zero at `x`.
131+
132+
```c
133+
double out = stdlib_base_besselj0( 0.0 );
134+
// returns 1.0
135+
136+
out = stdlib_base_besselj0( 1.0 );
137+
// returns ~0.765
138+
```
139+
140+
The function accepts the following arguments:
141+
142+
- **x**: `[in] double` input value.
143+
144+
```c
145+
double stdlib_base_besselj0( const double x );
146+
```
147+
148+
</section>
149+
150+
<!-- /.usage -->
151+
152+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
153+
154+
<section class="notes">
155+
156+
</section>
157+
158+
<!-- /.notes -->
159+
160+
<!-- C API usage examples. -->
161+
162+
<section class="examples">
163+
164+
### Examples
165+
166+
```c
167+
#include "stdlib/math/base/special/besselj0.h"
168+
#include <stdio.h>
169+
170+
int main( void ) {
171+
const double x[] = { 0.0, 1.0, 2.0, 3.0, 4.0 };
172+
173+
double y;
174+
int i;
175+
for ( i = 0; i < 5; i++ ) {
176+
y = stdlib_base_besselj0( x[ i ] );
177+
printf( "besselj0(%lf) = %lf\n", x[ i ], y );
178+
}
179+
}
180+
```
181+
182+
</section>
183+
184+
<!-- /.examples -->
185+
186+
</section>
187+
188+
<!-- /.c -->
189+
102190
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
103191

104192
<section class="related">
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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 resolve = require( 'path' ).resolve;
24+
var bench = require( '@stdlib/bench' );
25+
var randu = require( '@stdlib/random/base/randu' );
26+
var isnan = require( '@stdlib/math/base/assert/is-nan' );
27+
var tryRequire = require( '@stdlib/utils/try-require' );
28+
var pkg = require( './../package.json' ).name;
29+
30+
31+
// VARIABLES //
32+
33+
var j0 = tryRequire( resolve( __dirname, './../lib/native.js' ) );
34+
var opts = {
35+
'skip': ( j0 instanceof Error )
36+
};
37+
38+
39+
// MAIN //
40+
41+
bench( pkg+'::native', opts, function benchmark( b ) {
42+
var x;
43+
var y;
44+
var i;
45+
46+
b.tic();
47+
for ( i = 0; i < b.iterations; i++ ) {
48+
x = ( randu() * 100000.0 ) - 0.0;
49+
y = j0( x );
50+
if ( isnan( y ) ) {
51+
b.fail( 'should not return NaN' );
52+
}
53+
}
54+
b.toc();
55+
if ( isnan( y ) ) {
56+
b.fail( 'should not return NaN' );
57+
}
58+
b.pass( 'benchmark finished' );
59+
b.end();
60+
});

0 commit comments

Comments
 (0)