Skip to content

Commit ab2e77b

Browse files
committed
docs: update type
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 10beb0d commit ab2e77b

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

lib/node_modules/@stdlib/ndarray/array/docs/repl.txt

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
Data source. If provided along with a `buffer` argument, the argument
1515
takes precedence.
1616

17-
options.dtype: string (optional)
17+
options.dtype: string|DataType (optional)
1818
Underlying storage data type. If not specified and a data source is
1919
provided, the data type is inferred from the provided data source. If an
2020
input data source is not of the same type, this option specifies the
@@ -33,10 +33,10 @@
3333
- 'row-major': the order of the returned array is row-major.
3434
- 'column-major': the order of the returned array is column-major.
3535
- 'any': if a data source is column-major and not row-major, the order
36-
of the returned array is column-major; otherwise, the order of the
37-
returned array is row-major.
36+
of the returned array is column-major; otherwise, the order of the
37+
returned array is row-major.
3838
- 'same': the order of the returned array matches the order of an input
39-
data source.
39+
data source.
4040

4141
Note that specifying an order which differs from the order of a
4242
provided data source does *not* entail a conversion from one memory
@@ -82,11 +82,11 @@
8282
- 'equiv': allow casting between identical and byte swapped types.
8383
- 'safe': only allow "safe" casts.
8484
- 'mostly-safe': allow "safe casts" and, for floating-point data types,
85-
downcasts.
85+
downcasts.
8686
- 'same-kind': allow "safe" casts and casts within the same kind (e.g.,
87-
between signed integers or between floats).
87+
between signed integers or between floats).
8888
- 'unsafe': allow casting between all types (including between integers
89-
and floats).
89+
and floats).
9090

9191
Default: 'safe'.
9292

@@ -100,13 +100,13 @@
100100
option may be one of the following values:
101101

102102
- 'throw': an ndarray instance throws an error when an index exceeds
103-
array dimensions.
103+
array dimensions.
104104
- 'normalize': an ndarray instance normalizes negative indices and
105-
throws an error when an index exceeds array dimensions.
105+
throws an error when an index exceeds array dimensions.
106106
- 'wrap': an ndarray instance wraps around indices exceeding array
107-
dimensions using modulo arithmetic.
107+
dimensions using modulo arithmetic.
108108
- 'clamp', an ndarray instance sets an index exceeding array dimensions
109-
to either `0` (minimum index) or the maximum index.
109+
to either `0` (minimum index) or the maximum index.
110110

111111
Default: 'throw'.
112112

@@ -115,13 +115,13 @@
115115
mode for a corresponding dimension is equal to
116116

117117
- 'throw': an ndarray instance throws an error when a subscript exceeds
118-
array dimensions.
118+
array dimensions.
119119
- 'normalize': an ndarray instance normalizes negative subscripts and
120-
throws an error when a subscript exceeds array dimensions.
120+
throws an error when a subscript exceeds array dimensions.
121121
- 'wrap': an ndarray instance wraps around subscripts exceeding array
122-
dimensions using modulo arithmetic.
122+
dimensions using modulo arithmetic.
123123
- 'clamp': an ndarray instance sets a subscript exceeding array
124-
dimensions to either `0` (minimum index) or the maximum index.
124+
dimensions to either `0` (minimum index) or the maximum index.
125125

126126
If the number of modes is fewer than the number of dimensions, the
127127
function recycles modes using modulo arithmetic.

lib/node_modules/@stdlib/ndarray/array/lib/main.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ var defaults = getDefaults();
6868
* @param {(ArrayLikeObject|TypedArrayLike|Buffer|ndarrayLike)} [buffer] - data source
6969
* @param {Options} [options] - function options
7070
* @param {(ArrayLikeObject|TypedArrayLike|Buffer|ndarrayLike)} [options.buffer] - data source
71-
* @param {string} [options.dtype="float64"] - underlying storage data type (if the input data is not of the same type, this option specifies the data type to which to cast the input data)
71+
* @param {*} [options.dtype="float64"] - underlying storage data type (if the input data is not of the same type, this option specifies the data type to which to cast the input data)
7272
* @param {string} [options.order="row-major"] - specifies the memory layout of the array as either row-major (C-style) or column-major (Fortran-style)
7373
* @param {NonNegativeIntegerArray} [options.shape] - array shape
7474
* @param {string} [options.mode="throw"] - specifies how to handle indices which exceed array dimensions
@@ -206,6 +206,7 @@ function array() {
206206
if ( !isDataType( dtype ) ) {
207207
throw new TypeError( format( 'invalid option. `%s` option must be a recognized data type. Option: `%s`.', 'dtype', dtype ) );
208208
}
209+
dtype = String( dtype );
209210
if ( btype && !isAllowedCast( btype, dtype, opts.casting ) ) {
210211
throw new Error( format( 'invalid option. Data type cast is not allowed. Casting mode: `%s`. From: `%s`. To: `%s`.', opts.casting, btype, dtype ) );
211212
}

0 commit comments

Comments
 (0)