Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/stdlib-js/stdlib into de…
Browse files Browse the repository at this point in the history
…velop
  • Loading branch information
kgryte committed Aug 11, 2024
2 parents 09ffebd + 6c64208 commit 1745404
Show file tree
Hide file tree
Showing 31 changed files with 1,862 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ function formatBreakingChange( note ) {
var hash = trim( note.hash );
var out = '- [`'+hash.substring( 0, 7 )+'`]('+STDLIB_GITHUB_URL+'/'+hash+'): '+parts[ 0 ];
if ( parts.length > 1 ) {
out +=' \n\n';
out +='\n\n';
out += ' - ';
out += parts.slice( 1 ).join( '\n ' );
out += parts.slice( 1 ).join( '\n ' );
out += '\n';
}
return out;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

// MODULES //

var contains = require( '@stdlib/assert/contains' );
var isDigitString = require( '@stdlib/assert/is-digit-string' );
var filter = require( '@stdlib/array/base/filter' );
var map = require( '@stdlib/utils/map' );
var collectField = require( './collect_field.js' );
Expand All @@ -28,6 +30,11 @@ var sectionEnd = require( './section_end.js' );
var heading = require( './heading.js' );


// VARIABLES //

var VERBS = [ 'Closes', 'Fixes', 'Resolves' ];


// FUNCTIONS //

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

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[
"stdlib-bot <[email protected]>"
"dependabot[bot]",
"stdlib-bot"
]
Original file line number Diff line number Diff line change
Expand Up @@ -46,27 +46,33 @@ var RE_CO_AUTHORED_BY = /co-authored-by/i;
function extractContributors( commits ) {
var mentions;
var mention;
var author;
var out;
var i;
var j;

out = [];
for ( i = 0; i < commits.length; i++ ) {
author = replace( commits[ i ].author, /\s*<[^>]+>\s*/, '' );
if (
!contains( out, commits[ i ].author ) &&
!contains( EXCLUDED_CONTRIBUTORS, commits[ i ].author )
!contains( out, author ) &&
!contains( EXCLUDED_CONTRIBUTORS, author )
) {
out.push( commits[ i ].author );
out.push( author );
}
mentions = commits[ i ].mentions || [];
for ( j = 0; j < mentions.length; j++ ) {
mention = mentions[ j ];
if (
RE_CO_AUTHORED_BY.test( mention.action ) &&
!contains( out, mention.ref ) &&
!contains( EXCLUDED_CONTRIBUTORS, mention.ref )
RE_CO_AUTHORED_BY.test( mention.action )
) {
out.push( mention.ref );
author = replace( mention.ref, /\s*<[^>]+>\s*/, '' );
if (
!contains( out, author ) &&
!contains( EXCLUDED_CONTRIBUTORS, author )
) {
out.push( author );
}
}
}
}
Expand All @@ -77,15 +83,15 @@ function extractContributors( commits ) {
* Formats a contributor.
*
* @private
* @param {string} contributor - contributor
* @param {string} contributor - contributor name
* @returns {string} formatted contributor
*
* @example
* var out = formatContributor( 'Jane Doe <[email protected]>' );
* var out = formatContributor( 'Jane Doe' );
* // returns '- Jane Doe'
*/
function formatContributor( contributor ) {
return '- ' + replace( contributor, /\s*<[^>]+>\s*/, '' );
return '- ' + contributor;
}


Expand Down
72 changes: 39 additions & 33 deletions lib/node_modules/@stdlib/_tools/changelog/generate/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,22 +318,26 @@ function generate( pkg, releaseType ) {
if ( isNamespacePkg ) {
str += releaseSectionStart( nextVersion );
str += '## ' + ( nextVersion || 'Unreleased' ) + ' (' + formatDate() + ')\n\n';
bySubpackage = groupBySubPackage( commits.unreleased, pkg );
pkgNames = objectKeys( bySubpackage ).sort();
str += sectionStart( 'packages' );
str += heading( 'Packages', 3 );
for ( i = 0; i < pkgNames.length; i++ ) {
name = pkgNames[ i ];
unreleased = releaseSummary( bySubpackage[ name ], true, true );
if ( unreleased || nextVersion ) {
str += packageSummaryWrapper( pkg, '', name, unreleased || PLACEHOLDER_SUMMARY );
if ( commits.unreleased.length > 0 ) {
bySubpackage = groupBySubPackage( commits.unreleased, pkg );
pkgNames = objectKeys( bySubpackage ).sort();
str += sectionStart( 'packages' );
str += heading( 'Packages', 3 );
for ( i = 0; i < pkgNames.length; i++ ) {
name = pkgNames[ i ];
unreleased = releaseSummary( bySubpackage[ name ], true, true );
if ( unreleased ) {
str += packageSummaryWrapper( pkg, '', name, unreleased );
}
}
str += sectionEnd( 'packages' );
str += breakingChanges( commits.unreleased );
str += closedIssues( commits.unreleased );
str += formatContributors( commits.unreleased );
str += formatCommits( commits.unreleased );
} else {
str += PLACEHOLDER_SUMMARY;
}
str += sectionEnd( 'packages' );
str += breakingChanges( commits.unreleased );
str += closedIssues( commits.unreleased );
str += formatContributors( commits.unreleased );
str += formatCommits( commits.unreleased );
str += sectionEnd( 'release' );
} else {
unreleased = releaseSummary( commits.unreleased );
Expand All @@ -347,28 +351,30 @@ function generate( pkg, releaseType ) {
if ( isNamespacePkg ) {
for ( i = releases.length-1; i >= 0; i-- ) {
version = releases[ i ][ 0 ];
releaseCommits = commits[ version ];
if ( !releaseCommits ) {
releaseCommits = [];
}
str += releaseSectionStart( version );
str += '## ' + version + ' (' + formatDate( releases[ i ][ 1 ] ) + ')\n\n';
bySubpackage = groupBySubPackage( releaseCommits, pkg );
pkgNames = objectKeys( bySubpackage ).sort();
str += sectionStart( 'packages' );
str += heading( 'Packages', 3 );
for ( j = 0; j < pkgNames.length; j++ ) {
name = pkgNames[ j ];
summary = releaseSummary( bySubpackage[ name ], true, true );
if ( !summary ) {
summary = PLACEHOLDER_SUMMARY;
releaseCommits = commits[ version ];
if ( releaseCommits && releaseCommits.length > 0 ) {
bySubpackage = groupBySubPackage( releaseCommits, pkg );
pkgNames = objectKeys( bySubpackage ).sort();
str += sectionStart( 'packages' );
str += heading( 'Packages', 3 );
for ( j = 0; j < pkgNames.length; j++ ) {
name = pkgNames[ j ];
summary = releaseSummary( bySubpackage[ name ], true, true );
if ( summary ) {
str += packageSummaryWrapper( pkg, version, name, summary );
}
}
str += packageSummaryWrapper( pkg, version, name, summary );
str += sectionEnd( 'packages' );
str += breakingChanges( releaseCommits );
str += closedIssues( releaseCommits );
str += formatContributors( releaseCommits );
str += formatCommits( releaseCommits );
} else {
str += PLACEHOLDER_SUMMARY;
}
str += sectionEnd( 'packages' );
str += breakingChanges( releaseCommits );
str += closedIssues( releaseCommits );
str += formatContributors( releaseCommits );
str += formatCommits( releaseCommits );
str += sectionEnd( 'release' );
}
} else {
for ( i = releases.length-1; i >= 0; i-- ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ var RE_LEADING_HASH = /^\s*#/;
* @returns {Object} conventional changelog format
*/
function toConventionalChangelog( ast, options ) {
var breakingChanges = [];
var out = {
'type': '',
'scope': null,
Expand All @@ -64,6 +65,10 @@ function toConventionalChangelog( ast, options ) {
visitWithAncestors( ast, [ 'breaking-change' ], processBreakingChanges );
visit( ast, 'footer', processFooter );

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

/**
Expand Down Expand Up @@ -96,7 +101,7 @@ function toConventionalChangelog( ast, options ) {
break;
}
if ( breaking.text !== '' ) {
out.notes.push( breaking );
breakingChanges.push( breaking );
}

/**
Expand Down
88 changes: 88 additions & 0 deletions lib/node_modules/@stdlib/math/base/special/besselj0/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,94 @@ for ( i = 0; i < 100; i++ ) {

<!-- /.examples -->

<!-- C interface documentation. -->

* * *

<section class="c">

## C APIs

<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->

<section class="intro">

</section>

<!-- /.intro -->

<!-- C usage documentation. -->

<section class="usage">

### Usage

```c
#include "stdlib/math/base/special/besselj0.h"
```

#### stdlib_base_besselj0( x )

Computes the [Bessel function of the first kind][bessel-first-kind] of order zero at `x`.

```c
double out = stdlib_base_besselj0( 0.0 );
// returns 1.0

out = stdlib_base_besselj0( 1.0 );
// returns ~0.765
```

The function accepts the following arguments:

- **x**: `[in] double` input value.

```c
double stdlib_base_besselj0( const double x );
```
</section>
<!-- /.usage -->
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
<section class="notes">
</section>
<!-- /.notes -->
<!-- C API usage examples. -->
<section class="examples">
### Examples
```c
#include "stdlib/math/base/special/besselj0.h"
#include <stdio.h>
int main( void ) {
const double x[] = { 0.0, 1.0, 2.0, 3.0, 4.0 };
double y;
int i;
for ( i = 0; i < 5; i++ ) {
y = stdlib_base_besselj0( x[ i ] );
printf( "besselj0(%lf) = %lf\n", x[ i ], y );
}
}
```

</section>

<!-- /.examples -->

</section>

<!-- /.c -->

<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->

<section class="related">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2024 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

// MODULES //

var resolve = require( 'path' ).resolve;
var bench = require( '@stdlib/bench' );
var randu = require( '@stdlib/random/base/randu' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var tryRequire = require( '@stdlib/utils/try-require' );
var pkg = require( './../package.json' ).name;


// VARIABLES //

var j0 = tryRequire( resolve( __dirname, './../lib/native.js' ) );
var opts = {
'skip': ( j0 instanceof Error )
};


// MAIN //

bench( pkg+'::native', opts, function benchmark( b ) {
var x;
var y;
var i;

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
x = ( randu() * 100000.0 ) - 0.0;
y = j0( x );
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
}
b.toc();
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
b.end();
});
Loading

1 comment on commit 1745404

@stdlib-bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage Report

Package Statements Branches Functions Lines
namespace/alias2pkg $\color{green}95/95$
$\color{green}+100.00\%$
$\color{green}7/7$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}95/95$
$\color{green}+100.00\%$
namespace/alias2related $\color{green}95/95$
$\color{green}+100.00\%$
$\color{green}7/7$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}95/95$
$\color{green}+100.00\%$
namespace/alias2standalone $\color{green}95/95$
$\color{green}+100.00\%$
$\color{green}7/7$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}95/95$
$\color{green}+100.00\%$
namespace/aliases $\color{green}144/144$
$\color{green}+100.00\%$
$\color{green}14/14$
$\color{green}+100.00\%$
$\color{green}2/2$
$\color{green}+100.00\%$
$\color{green}144/144$
$\color{green}+100.00\%$
namespace $\color{green}95/95$
$\color{green}+100.00\%$
$\color{green}4/4$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}95/95$
$\color{green}+100.00\%$
namespace/pkg2alias $\color{green}100/100$
$\color{green}+100.00\%$
$\color{green}10/10$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}100/100$
$\color{green}+100.00\%$
namespace/pkg2related $\color{green}100/100$
$\color{green}+100.00\%$
$\color{green}10/10$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}100/100$
$\color{green}+100.00\%$
namespace/pkg2standalone $\color{green}95/95$
$\color{green}+100.00\%$
$\color{green}7/7$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}95/95$
$\color{green}+100.00\%$
namespace/standalone2pkg $\color{green}95/95$
$\color{green}+100.00\%$
$\color{green}7/7$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}95/95$
$\color{green}+100.00\%$
ndarray/iter/interleave-subarrays $\color{green}279/279$
$\color{green}+100.00\%$
$\color{green}28/28$
$\color{green}+100.00\%$
$\color{green}4/4$
$\color{green}+100.00\%$
$\color{green}279/279$
$\color{green}+100.00\%$
ndarray/iter $\color{green}168/168$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}0/0$
$\color{green}+100.00\%$
$\color{green}168/168$
$\color{green}+100.00\%$
repl/code-blocks $\color{green}95/95$
$\color{green}+100.00\%$
$\color{green}7/7$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}95/95$
$\color{green}+100.00\%$
repl/help $\color{green}95/95$
$\color{green}+100.00\%$
$\color{green}7/7$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}95/95$
$\color{green}+100.00\%$
repl/info $\color{green}95/95$
$\color{green}+100.00\%$
$\color{green}7/7$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}95/95$
$\color{green}+100.00\%$
repl/signature $\color{green}99/99$
$\color{green}+100.00\%$
$\color{green}10/10$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}99/99$
$\color{green}+100.00\%$
repl/typed-signature $\color{green}99/99$
$\color{green}+100.00\%$
$\color{green}10/10$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}99/99$
$\color{green}+100.00\%$

The above coverage report was generated for the changes in this push.

Please sign in to comment.