Skip to content

Commit 876aff2

Browse files
committed
Auto-generated commit
1 parent fc1d338 commit 876aff2

8 files changed

Lines changed: 64 additions & 8 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: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,40 @@
22

33
> Package changelog.
44
5+
<section class="release" id="unreleased">
6+
7+
## Unreleased (2026-03-30)
8+
9+
<section class="commits">
10+
11+
### Commits
12+
13+
<details>
14+
15+
- [`3323474`](https://github.com/stdlib-js/stdlib/commit/3323474c193b0a1cf6501ea8bf54381392562af6) - **refactor:** explicitly validate a provided input dtype _(by Athan Reines)_
16+
17+
</details>
18+
19+
</section>
20+
21+
<!-- /.commits -->
22+
23+
<section class="contributors">
24+
25+
### Contributors
26+
27+
A total of 1 person contributed to this release. Thank you to this contributor:
28+
29+
- Athan Reines
30+
31+
</section>
32+
33+
<!-- /.contributors -->
34+
35+
</section>
36+
37+
<!-- /.release -->
38+
539
<section class="release" id="v0.2.2">
640

741
## 0.2.2 (2026-02-08)

dist/index.js

Lines changed: 1 addition & 1 deletion
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: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,22 @@
2020

2121
// MODULES //
2222

23+
var contains = require( '@stdlib/array-base-assert-contains' ).factory;
2324
var Complex128 = require( '@stdlib/complex-float64-ctor' );
2425
var Complex64 = require( '@stdlib/complex-float32-ctor' );
2526
var full = require( '@stdlib/array-full' );
27+
var dtypes = require( '@stdlib/array-dtypes' );
2628
var defaults = require( '@stdlib/array-defaults' );
29+
var join = require( '@stdlib/array-base-join' );
30+
var format = require( '@stdlib/string-format' );
2731

2832

2933
// VARIABLES //
3034

3135
var Z128 = new Complex128( 1.0, 0.0 );
3236
var Z64 = new Complex64( 1.0, 0.0 );
37+
var DTYPES = dtypes( 'numeric_and_generic' );
38+
var isValidDType = contains( DTYPES );
3339
var DEFAULT_DTYPE = defaults.get( 'dtypes.default' );
3440

3541

@@ -58,6 +64,9 @@ function ones( length ) {
5864

5965
if ( arguments.length > 1 ) {
6066
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+
}
6170
} else {
6271
dtype = DEFAULT_DTYPE;
6372
}

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,20 @@
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-defaults": "^0.4.1",
43+
"@stdlib/array-dtypes": "^0.4.1",
4144
"@stdlib/array-full": "^0.3.1",
4245
"@stdlib/complex-float32-ctor": "^0.1.1",
4346
"@stdlib/complex-float64-ctor": "^0.1.2",
44-
"@stdlib/types": "^0.4.3"
47+
"@stdlib/string-format": "^0.2.3",
48+
"@stdlib/types": "^0.4.3",
49+
"@stdlib/error-tools-fmtprodmsg": "^0.2.3"
4550
},
4651
"devDependencies": {
4752
"@stdlib/array-complex128": "^0.3.2",
4853
"@stdlib/array-complex64": "^0.3.2",
49-
"@stdlib/array-dtypes": "^0.4.1",
5054
"@stdlib/array-float32": "^0.2.3",
5155
"@stdlib/array-float64": "^0.2.3",
5256
"@stdlib/array-int16": "^0.2.3",
@@ -63,7 +67,6 @@
6367
"@stdlib/math-base-special-pow": "^0.3.1",
6468
"@stdlib/strided-base-reinterpret-complex128": "^0.2.3",
6569
"@stdlib/strided-base-reinterpret-complex64": "^0.2.2",
66-
"@stdlib/string-format": "^0.2.3",
6770
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
6871
"istanbul": "^0.4.1",
6972
"tap-min": "git+https://github.com/Planeshifter/tap-min.git",

0 commit comments

Comments
 (0)