Skip to content

Commit 9dacfb9

Browse files
committed
Merge branch 'develop' of https://github.com/stdlib-js/stdlib into develop
2 parents 90bb3d0 + 0c19d45 commit 9dacfb9

File tree

24 files changed

+592
-35
lines changed

24 files changed

+592
-35
lines changed

CONTRIBUTORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ Naveen Kumar <[email protected]>
106106
Neeraj Pathak <[email protected]>
107107
NirvedMishra <[email protected]>
108108
Nishant Shinde <[email protected]>
109+
Nishant singh <[email protected]>
109110
Nishchay Rajput <[email protected]>
110111
Nithin Katta <[email protected]>
111112
Nourhan Hasan <[email protected]>

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

Lines changed: 66 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/**
32
* @license Apache-2.0
43
*
@@ -24,6 +23,7 @@
2423
var filter = require( '@stdlib/array/base/filter' );
2524
var trim = require( '@stdlib/string/trim' );
2625
var map = require( '@stdlib/utils/map' );
26+
var reEOL = require( '@stdlib/regexp/eol' );
2727
var collectField = require( './collect_field.js' );
2828
var sectionStart = require( './section_start.js' );
2929
var sectionEnd = require( './section_end.js' );
@@ -33,10 +33,51 @@ var heading = require( './heading.js' );
3333
// VARIABLES //
3434

3535
var STDLIB_GITHUB_URL = 'https://github.com/stdlib-js/stdlib/commit';
36+
var RE_YAML_DELIMITER = /^\s*---\s*$/;
3637

3738

3839
// FUNCTIONS //
3940

41+
/**
42+
* Processes commit message text by removing YAML blocks and squashing multiple empty lines into a single empty line.
43+
*
44+
* @private
45+
* @param {Array<string>} lines - text lines to process
46+
* @returns {Array<string>} processed commit message lines
47+
*/
48+
function stripYamlBlocks( lines ) {
49+
var previousLineEmpty;
50+
var inYaml;
51+
var out;
52+
var i;
53+
54+
previousLineEmpty = false;
55+
inYaml = false;
56+
out = [];
57+
for ( i = 0; i < lines.length; i++ ) {
58+
// Check for YAML delimiter (---) with optional whitespace:
59+
if ( RE_YAML_DELIMITER.test( lines[ i ] ) ) {
60+
inYaml = !inYaml; // Toggle YAML block state
61+
continue;
62+
}
63+
// Only include lines that are not part of YAML blocks:
64+
if ( inYaml ) {
65+
continue;
66+
}
67+
if ( trim( lines[ i ] ) === '' ) {
68+
// Only add an empty line if the previous line wasn't empty:
69+
if ( !previousLineEmpty && out.length > 0 ) {
70+
previousLineEmpty = true;
71+
out.push( '' );
72+
}
73+
} else {
74+
previousLineEmpty = false;
75+
out.push( lines[ i ] ); // Preserve original line formatting
76+
}
77+
}
78+
return out;
79+
}
80+
4081
/**
4182
* Formats a breaking change.
4283
*
@@ -54,13 +95,26 @@ var STDLIB_GITHUB_URL = 'https://github.com/stdlib-js/stdlib/commit';
5495
* // returns '- [`abcdef1`](https://github.com/stdlib-js/stdlib/commit/abcdef1234567890): beep'
5596
*/
5697
function formatBreakingChange( note ) {
57-
var parts = note.text.split( '\n' );
58-
var hash = trim( note.hash );
59-
var out = '- [`'+hash.substring( 0, 7 )+'`]('+STDLIB_GITHUB_URL+'/'+hash+'): '+parts[ 0 ];
60-
if ( parts.length > 1 ) {
61-
out +='\n\n';
62-
out += ' - ';
63-
out += parts.slice( 1 ).join( '\n ' );
98+
var contentLines;
99+
var textLines;
100+
var firstLine;
101+
var restLines;
102+
var hash;
103+
var out;
104+
105+
textLines = note.text.split( reEOL.REGEXP );
106+
contentLines = stripYamlBlocks( textLines );
107+
108+
// If we have content, first element is the first line:
109+
firstLine = contentLines[ 0 ] || '';
110+
restLines = contentLines.slice( 1 );
111+
hash = trim( note.hash );
112+
113+
// Construct output string:
114+
out = '- [`' + hash.substring( 0, 7 ) + '`](' + STDLIB_GITHUB_URL + '/' + hash + '): ' + firstLine;
115+
if ( restLines.length > 0 ) {
116+
out += '\n\n';
117+
out += ' - ' + restLines.join( '\n ' );
64118
out += '\n';
65119
}
66120
return out;
@@ -88,18 +142,18 @@ function isBreakingChange( note ) {
88142
* @returns {string} list of breaking changes
89143
*/
90144
function breakingChanges( commits ) {
91-
var breakingChanges;
145+
var changes;
92146
var notes;
93147
var out;
94148

95149
notes = collectField( commits, 'notes' );
96-
breakingChanges = filter( notes, isBreakingChange );
97-
if ( breakingChanges.length === 0 ) {
150+
changes = filter( notes, isBreakingChange );
151+
if ( changes.length === 0 ) {
98152
return '';
99153
}
100154
out = sectionStart( 'breaking-changes' );
101155
out += heading( 'BREAKING CHANGES', 3 );
102-
out += map( breakingChanges, formatBreakingChange ).join( '\n' );
156+
out += map( changes, formatBreakingChange ).join( '\n' );
103157
out += sectionEnd( 'breaking-changes' );
104158
return out;
105159
}
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
<!--
2+
3+
@license Apache-2.0
4+
5+
Copyright (c) 2025 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+
# FLOAT64_MAX_NTH_DOUBLE_FACTORIAL
22+
23+
> Maximum nth [double factorial][double-factorial] when stored in [double-precision floating-point][ieee754] format.
24+
25+
<section class="usage">
26+
27+
## Usage
28+
29+
<!-- eslint-disable id-length -->
30+
31+
```javascript
32+
var FLOAT64_MAX_NTH_DOUBLE_FACTORIAL = require( '@stdlib/constants/float64/max-nth-double-factorial' );
33+
```
34+
35+
#### FLOAT64_MAX_NTH_DOUBLE_FACTORIAL
36+
37+
The maximum nth [double factorial][double-factorial] when stored in [double-precision floating-point][ieee754] format.
38+
39+
<!-- eslint-disable id-length -->
40+
41+
```javascript
42+
var bool = ( FLOAT64_MAX_NTH_DOUBLE_FACTORIAL === 300 );
43+
// returns true
44+
```
45+
46+
</section>
47+
48+
<!-- /.usage -->
49+
50+
<section class="examples">
51+
52+
## Examples
53+
54+
<!-- eslint-disable id-length -->
55+
56+
<!-- eslint no-undef: "error" -->
57+
58+
```javascript
59+
var FLOAT64_MAX_NTH_DOUBLE_FACTORIAL = require( '@stdlib/constants/float64/max-nth-double-factorial' );
60+
61+
function factorial2( n ) {
62+
var a;
63+
var i;
64+
65+
a = 1;
66+
for ( i = n; i >= 2; i -= 2 ) {
67+
a *= i;
68+
}
69+
return a;
70+
}
71+
72+
var v;
73+
var i;
74+
for ( i = 0; i < 400; i++ ) {
75+
v = factorial2( i );
76+
if ( i > FLOAT64_MAX_NTH_DOUBLE_FACTORIAL ) {
77+
console.log( 'Overflow: %d', v );
78+
} else {
79+
console.log( 'Valid: %d', v );
80+
}
81+
}
82+
```
83+
84+
</section>
85+
86+
<!-- /.examples -->
87+
88+
<!-- C interface documentation. -->
89+
90+
* * *
91+
92+
<section class="c">
93+
94+
## C APIs
95+
96+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
97+
98+
<section class="intro">
99+
100+
</section>
101+
102+
<!-- /.intro -->
103+
104+
<!-- C usage documentation. -->
105+
106+
<section class="usage">
107+
108+
### Usage
109+
110+
```c
111+
#include "stdlib/constants/float64/max_nth_double_factorial.h"
112+
```
113+
114+
#### STDLIB_CONSTANT_FLOAT64_MAX_NTH_DOUBLE_FACTORIAL
115+
116+
Macro for the maximum nth [double factorial][double-factorial] when stored in [double-precision floating-point][ieee754] format.
117+
118+
</section>
119+
120+
<!-- /.usage -->
121+
122+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
123+
124+
<section class="notes">
125+
126+
</section>
127+
128+
<!-- /.notes -->
129+
130+
<!-- C API usage examples. -->
131+
132+
<section class="examples">
133+
134+
</section>
135+
136+
<!-- /.examples -->
137+
138+
</section>
139+
140+
<!-- /.c -->
141+
142+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
143+
144+
<section class="related">
145+
146+
</section>
147+
148+
<!-- /.related -->
149+
150+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
151+
152+
<section class="links">
153+
154+
[double-factorial]: https://en.wikipedia.org/wiki/Double_factorial
155+
156+
[ieee754]: https://en.wikipedia.org/wiki/IEEE_754-1985
157+
158+
<!-- <related-links> -->
159+
160+
<!-- </related-links> -->
161+
162+
</section>
163+
164+
<!-- /.links -->
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
{{alias}}
3+
Maximum nth double factorial when stored in double-precision floating-point
4+
format.
5+
6+
Examples
7+
--------
8+
> {{alias}}
9+
300
10+
11+
See Also
12+
--------
13+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 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+
// TypeScript Version: 4.1
20+
21+
/**
22+
* Maximum nth double factorial when stored in double-precision floating-point format.
23+
*
24+
* @example
25+
* var max = FLOAT64_MAX_NTH_DOUBLE_FACTORIAL;
26+
* // returns 300
27+
*/
28+
declare const FLOAT64_MAX_NTH_DOUBLE_FACTORIAL: number;
29+
30+
31+
// EXPORTS //
32+
33+
export = FLOAT64_MAX_NTH_DOUBLE_FACTORIAL;
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 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+
import FLOAT64_MAX_NTH_DOUBLE_FACTORIAL = require( './index' );
20+
21+
22+
// TESTS //
23+
24+
// The export is a number...
25+
{
26+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
27+
FLOAT64_MAX_NTH_DOUBLE_FACTORIAL; // $ExpectType number
28+
}

0 commit comments

Comments
 (0)