Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: update scaffolding for creating unary math iterator packages #2927

Merged
merged 27 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
b301b79
chore: add runner script to create packages
gunjjoshi Sep 20, 2024
e065b72
Merge branch 'stdlib-js:develop' into math-iter-unary
gunjjoshi Sep 26, 2024
6522b2b
docs: update scaffold.sh
gunjjoshi Sep 27, 2024
ac6aacb
chore: update scaffold.sh
gunjjoshi Sep 27, 2024
d3c7b42
chore: update runner.js and scaffold.sh
gunjjoshi Sep 28, 2024
34d465c
Update scaffold.sh
gunjjoshi Sep 28, 2024
ae524f5
docs: update scaffold.sh
gunjjoshi Sep 29, 2024
7c65bac
Merge branch 'math-iter-unary' of https://github.com/gunjjoshi/stdlib…
gunjjoshi Sep 29, 2024
13cf609
chore: add keywords in the names array
gunjjoshi Sep 29, 2024
abbf3bc
Update lib/node_modules/@stdlib/_tools/scaffold/math-iter-unary/scrip…
gunjjoshi Oct 3, 2024
6067078
chore: move capitalizing logic to runner.js
gunjjoshi Oct 3, 2024
7079976
Apply suggestions from code review
kgryte Oct 4, 2024
2a94c9e
Apply suggestions from code review
kgryte Oct 4, 2024
3c0879e
refactor: fix environment variable logic and support specifying the b…
kgryte Oct 4, 2024
8be8688
style: remove unused variables
kgryte Oct 4, 2024
d780577
refactor: add support for specifying JavaScript return type
kgryte Oct 4, 2024
e0301aa
fix: update property access
kgryte Oct 4, 2024
c43e064
fix: update env var concat
kgryte Oct 4, 2024
ff2c1a8
refactor: clean up env var concat
kgryte Oct 4, 2024
d0448bb
refactor: update keywords and assertion methods
kgryte Oct 4, 2024
4acf56d
refactor: update default pkg desc
kgryte Oct 4, 2024
053de2c
fix: update link and handle decimal values
kgryte Oct 4, 2024
e4ed66d
refactor: add decimals for floating-point parameter values
kgryte Oct 4, 2024
474653b
style: disable lint rule
kgryte Oct 4, 2024
b40c84a
refactor: add comment indicating that files are generated
kgryte Oct 4, 2024
eae6a5c
build: don't overwrite by default
kgryte Oct 4, 2024
00eda1b
fix: update require path and ensure numeric type
kgryte Oct 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ limitations under the License.

-->

<!-- THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. -->

# {{ALIAS}}

> {{PKG_DESC}}
Expand Down Expand Up @@ -90,11 +92,11 @@ The returned [iterator][mdn-iterator-protocol] protocol-compliant object has the
<!-- eslint no-undef: "error" -->

```javascript
var uniform = require( '@stdlib/random/iter/uniform' );
var random = require( '@stdlib/random/iter/{{BASE_PRNG}}' );
var {{ALIAS}} = require( '@{{PKG}}' );

// Create a seeded iterator for generating pseudorandom numbers:
var rand = uniform( {{RAND_MIN}}, {{RAND_MAX}}, {
var rand = random( {{RAND_MIN}}, {{RAND_MAX}}, {
'seed': 1234,
'iter': 10
});
Expand Down Expand Up @@ -139,7 +141,7 @@ while ( true ) {

[mdn-iterator-protocol]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterator_protocol

[@{{UNARY_PKG}}]: https://github.com/stdlib-js/stdlib
[@{{UNARY_PKG}}]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40{{UNARY_PKG}}

</section>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@
* limitations under the License.
*/

/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */

'use strict';

// MODULES //

var bench = require( '@stdlib/bench' );
var uniform = require( '@stdlib/random/iter/uniform' );
var random = require( '@stdlib/random/iter/{{BASE_PRNG}}' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var isIteratorLike = require( '@stdlib/assert/is-iterator-like' );
var pkg = require( './../package.json' ).name;
Expand All @@ -35,7 +37,7 @@ bench( pkg, function benchmark( b ) {
var iter;
var i;

rand = uniform( {{RAND_MIN}}, {{RAND_MAX}} );
rand = random( {{RAND_MIN}}, {{RAND_MAX}} );

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
Expand All @@ -58,7 +60,7 @@ bench( pkg+'::iteration', function benchmark( b ) {
var z;
var i;

rand = uniform( {{RAND_MIN}}, {{RAND_MAX}} );
rand = random( {{RAND_MIN}}, {{RAND_MAX}} );
iter = {{ALIAS}}( rand );

b.tic();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@

Examples
--------
> var r = {{alias:@stdlib/random/iter/uniform}}( {{RAND_MIN}}, {{RAND_MAX}} );
> var r = {{alias:@stdlib/random/iter/{{BASE_PRNG}}}}( {{RAND_MIN}}, {{RAND_MAX}} );
> var it = {{alias}}( r );
> var v = it.next().value
<number>
<{{JAVASCRIPT_RETURN_TYPE}}>
> v = it.next().value
<number>
<{{JAVASCRIPT_RETURN_TYPE}}>

See Also
--------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
* limitations under the License.
*/

/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */

// TypeScript Version: 4.1

/// <reference types="@stdlib/types"/>

import { TypedIterator as Iter, TypedIterableIterator } from '@stdlib/types/iter';
import { TypedIterator as Iter, TypedIterableIterator as IterableIterator } from '@stdlib/types/iter';

// Define a union type representing both iterable and non-iterable iterators:
type Iterator<T> = Iter<T> | IterableIterator<T>;
Expand All @@ -36,22 +38,22 @@ type Iterator<T> = Iter<T> | IterableIterator<T>;
* @returns iterator
*
* @example
* var uniform = require( `@stdlib/random/iter/uniform` );
* var random = require( '@stdlib/random/iter/{{BASE_PRNG}}' );
*
* var iter = {{ALIAS}}( uniform( {{RAND_MIN}}, {{RAND_MAX}} ) );
* var iter = {{ALIAS}}( random( {{RAND_MIN}}, {{RAND_MAX}} ) );
*
* var v = iter.next().value;
* // returns <number>
* // returns <{{JAVASCRIPT_RETURN_TYPE}}>
*
* v = iter.next().value;
* // returns <number>
* // returns <{{JAVASCRIPT_RETURN_TYPE}}>
*
* v = iter.next().value;
* // returns <number>
* // returns <{{JAVASCRIPT_RETURN_TYPE}}>
*
* // ...
*/
declare function {{ALIAS}}( iterator: Iterator<number> ): Iterator<number>;
declare function {{ALIAS}}( iterator: Iterator<{{JAVASCRIPT_RETURN_TYPE}}> ): Iterator<{{JAVASCRIPT_RETURN_TYPE}}>;


// EXPORTS //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* limitations under the License.
*/

/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */

import {{ALIAS}} = require( './index' );

/**
Expand All @@ -36,7 +38,7 @@ function iterator() {
*/
function next() {
return {
'value': true,
'value': 1.0,
'done': false
};
}
Expand All @@ -46,7 +48,7 @@ function next() {

// The function returns an iterator...
{
{{ALIAS}}( iterator() ); // $ExpectType TypedIterator<number>
{{ALIAS}}( iterator() ); // $ExpectType TypedIterator<{{JAVASCRIPT_RETURN_TYPE}}>
}

// The compiler throws an error if the function is provided a first argument which is not an iterator protocol-compliant object...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@
* limitations under the License.
*/

/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */

'use strict';

var uniform = require( '@stdlib/random/iter/uniform' );
var random = require( '@stdlib/random/iter/{{BASE_PRNG}}' );
var {{ALIAS}} = require( './../lib' );

// Create a seeded iterator for generating pseudorandom numbers:
var rand = uniform( {{RAND_MIN}}, {{RAND_MAX}}, {
var rand = random( {{RAND_MIN}}, {{RAND_MAX}}, {
'seed': 1234,
'iter': 10
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* limitations under the License.
*/

/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */

'use strict';

/**
Expand All @@ -24,28 +26,28 @@
* @module @{{PKG}}
*
* @example
* var uniform = require( '@stdlib/random/iter/uniform' );
* var random = require( '@stdlib/random/iter/{{BASE_PRNG}}' );
* var {{ALIAS}} = require( '@{{PKG}}' );
*
* var iter = {{ALIAS}}( uniform( {{RAND_MIN}}, {{RAND_MAX}} ) );
* var iter = {{ALIAS}}( random( {{RAND_MIN}}, {{RAND_MAX}} ) );
*
* var v = iter.next().value;
* // returns <number>
* // returns <{{JAVASCRIPT_RETURN_TYPE}}>
*
* v = iter.next().value;
* // returns <number>
* // returns <{{JAVASCRIPT_RETURN_TYPE}}>
*
* v = iter.next().value;
* // returns <number>
* // returns <{{JAVASCRIPT_RETURN_TYPE}}>
*
* // ...
*/

// MODULES //

var iterator = require( './main.js' );
var main = require( './main.js' );


// EXPORTS //

module.exports = iterator;
module.exports = main;
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* limitations under the License.
*/

/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */

'use strict';

// MODULES //
Expand All @@ -38,18 +40,18 @@ var {{UNARY_ALIAS}} = require( '@{{UNARY_PKG}}' );
* @returns {Iterator} iterator
*
* @example
* var uniform = require( '@stdlib/random/iter/uniform' );
* var random = require( '@stdlib/random/iter/{{BASE_PRNG}}' );
*
* var iter = {{ALIAS}}( uniform( {{RAND_MIN}}, {{RAND_MAX}} ) );
* var iter = {{ALIAS}}( random( {{RAND_MIN}}, {{RAND_MAX}} ) );
*
* var v = iter.next().value;
* // returns <number>
* // returns <{{JAVASCRIPT_RETURN_TYPE}}>
*
* v = iter.next().value;
* // returns <number>
* // returns <{{JAVASCRIPT_RETURN_TYPE}}>
*
* v = iter.next().value;
* // returns <number>
* // returns <{{JAVASCRIPT_RETURN_TYPE}}>
*
* // ...
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@
"windows"
],
"keywords": [
"stdlib",{{KEYWORDS}}
"stdlib",
"stdmath",
"math",
"mathematics",{{KEYWORDS}}
"iterator",
"iterable",
"iterate"
Expand Down
Loading