Skip to content

Commit ac080f3

Browse files
committed
Auto-generated commit
1 parent 813b427 commit ac080f3

File tree

6 files changed

+21
-10
lines changed

6 files changed

+21
-10
lines changed

.github/.keepalive

Lines changed: 0 additions & 1 deletion
This file was deleted.

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44
55
<section class="release" id="unreleased">
66

7-
## Unreleased (2026-03-23)
7+
## Unreleased (2026-03-30)
88

99
<section class="commits">
1010

1111
### Commits
1212

1313
<details>
1414

15+
- [`b85a1da`](https://github.com/stdlib-js/stdlib/commit/b85a1da40b6ea52d966f7294933908c5d4c839d9) - **refactor:** perform expliict dtype argument validation _(by Athan Reines)_
1516
- [`bb63f81`](https://github.com/stdlib-js/stdlib/commit/bb63f8127455cd4fc055aec5aa600f4e5b1eafb5) - **bench:** refactor to use string interpolation in `array/zeros` [(#10272)](https://github.com/stdlib-js/stdlib/pull/10272) _(by Aman Singh)_
1617

1718
</details>
@@ -24,9 +25,10 @@
2425

2526
### Contributors
2627

27-
A total of 1 person contributed to this release. Thank you to this contributor:
28+
A total of 2 people contributed to this release. Thank you to the following contributors:
2829

2930
- Aman Singh
31+
- Athan Reines
3032

3133
</section>
3234

dist/index.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/main.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,21 @@
2020

2121
// MODULES //
2222

23+
var contains = require( '@stdlib/array-base-assert-contains' ).factory;
2324
var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;
2425
var ctors = require( '@stdlib/array-ctors' );
2526
var gzeros = require( '@stdlib/array-base-zeros' );
27+
var dtypes = require( '@stdlib/array-dtypes' );
2628
var defaults = require( '@stdlib/array-defaults' );
29+
var join = require( '@stdlib/array-base-join' );
2730
var format = require( '@stdlib/string-format' );
2831

2932

3033
// VARIABLES //
3134

3235
var DEFAULT_DTYPE = defaults.get( 'dtypes.default' );
36+
var DTYPES = dtypes( 'numeric_and_generic' );
37+
var isValidDType = contains( DTYPES );
3338

3439

3540
// MAIN //
@@ -59,6 +64,9 @@ function zeros( length ) {
5964
}
6065
if ( arguments.length > 1 ) {
6166
dtype = arguments[ 1 ];
67+
if ( !isValidDType( dtype ) ) {
68+
throw new TypeError( format( 'invalid argument. Second argument must be one of the following: "%s". Value: `%s`.', join( DTYPES, '", "' ), dtype ) );
69+
}
6270
} else {
6371
dtype = DEFAULT_DTYPE;
6472
}

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,12 @@
3737
"url": "https://github.com/stdlib-js/stdlib/issues"
3838
},
3939
"dependencies": {
40+
"@stdlib/array-base-assert-contains": "^0.2.3",
41+
"@stdlib/array-base-join": "^0.1.2",
4042
"@stdlib/array-base-zeros": "^0.2.3",
4143
"@stdlib/array-ctors": "^0.3.1",
4244
"@stdlib/array-defaults": "^0.4.1",
45+
"@stdlib/array-dtypes": "^0.4.1",
4346
"@stdlib/assert-is-nonnegative-integer": "^0.2.3",
4447
"@stdlib/string-format": "^0.2.3",
4548
"@stdlib/types": "^0.4.3",
@@ -48,7 +51,6 @@
4851
"devDependencies": {
4952
"@stdlib/array-complex128": "^0.3.2",
5053
"@stdlib/array-complex64": "^0.3.2",
51-
"@stdlib/array-dtypes": "^0.4.1",
5254
"@stdlib/array-float32": "^0.2.3",
5355
"@stdlib/array-float64": "^0.2.3",
5456
"@stdlib/array-int16": "^0.2.3",

0 commit comments

Comments
 (0)