Skip to content

Commit 718efe5

Browse files
committed
Auto-generated commit
1 parent 6586aff commit 718efe5

8 files changed

Lines changed: 38 additions & 9 deletions

File tree

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,15 @@ indent_style = tab
165165
indent_style = space
166166
indent_size = 2
167167
168+
# Ignore generated lock files for GitHub Agentic Workflows:
169+
[*.lock.yml]
170+
charset = unset
171+
end_of_line = unset
172+
indent_style = unset
173+
indent_size = unset
174+
trim_trailing_whitespace = unset
175+
insert_final_newline = unset
176+
168177
# Set properties for GYP files:
169178
[binding.gyp]
170179
indent_style = space

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,5 @@ Makefile linguist-vendored
6464

6565
# Configure files which should be included in GitHub language statistics:
6666
docs/types/*.d.ts -linguist-documentation
67+
68+
.github/workflows/*.lock.yml linguist-generated=true merge=ours

.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-02)
7+
## Unreleased (2026-03-30)
88

99
<section class="commits">
1010

1111
### Commits
1212

1313
<details>
1414

15+
- [`bfc9322`](https://github.com/stdlib-js/stdlib/commit/bfc9322020792df4f47ea649d6fbed509284f6bd) - **refactor:** perform explicit dtype validation _(by Athan Reines)_
1516
- [`bad91bf`](https://github.com/stdlib-js/stdlib/commit/bad91bf9fad4693af649750fd4ebe30640358e48) - **bench:** refactor to use string interpolation in `array/zero-to-like` [(#10350)](https://github.com/stdlib-js/stdlib/pull/10350) _(by Shubham)_
1617

1718
</details>
@@ -24,8 +25,9 @@
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

30+
- Athan Reines
2931
- Shubham
3032

3133
</section>

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: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,20 @@
2020

2121
// MODULES //
2222

23+
var contains = require( '@stdlib/array-base-assert-contains' ).factory;
2324
var zeroTo = require( '@stdlib/array-zero-to' );
2425
var dtype = require( '@stdlib/array-dtype' );
26+
var dtypes = require( '@stdlib/array-dtypes' );
27+
var join = require( '@stdlib/array-base-join' );
2528
var format = require( '@stdlib/string-format' );
2629

2730

31+
// VARIABLES //
32+
33+
var DTYPES = dtypes( 'numeric_and_generic' );
34+
var isValidDType = contains( DTYPES );
35+
36+
2837
// MAIN //
2938

3039
/**
@@ -51,6 +60,11 @@ function zeroToLike( x ) {
5160
}
5261
if ( arguments.length > 1 ) {
5362
dt = arguments[ 1 ];
63+
if ( !isValidDType( dt ) ) {
64+
throw new TypeError( format( 'invalid argument. Second argument must be one of the following: "%s". Value: `%s`.', join( DTYPES, '", "' ), dt ) );
65+
}
66+
} else if ( !isValidDType( dt ) ) {
67+
throw new TypeError( format( 'invalid argument. First argument must have one of the following data types: "%s". Value: `%s`.', join( DTYPES, '", "' ), dt ) );
5468
}
5569
return zeroTo( x.length, dt );
5670
}

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@
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-dtype": "^0.3.1",
43+
"@stdlib/array-dtypes": "^0.4.1",
4144
"@stdlib/array-zero-to": "^0.2.3",
4245
"@stdlib/string-format": "^0.2.3",
4346
"@stdlib/types": "^0.4.3",

0 commit comments

Comments
 (0)