Skip to content

Commit 7899877

Browse files
committed
refactor: defensively copy provided dtype arrays
--- 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: na - 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 6d64a34 commit 7899877

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

  • lib/node_modules/@stdlib/math/array/tools/unary/lib

lib/node_modules/@stdlib/math/array/tools/unary/lib/main.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ var odtype = require( '@stdlib/ndarray/base/unary-output-dtype' );
3333
var empty = require( '@stdlib/array/empty' );
3434
var dtype = require( '@stdlib/array/dtype' );
3535
var everyBy = require( '@stdlib/array/base/every-by' );
36+
var copy = require( '@stdlib/array/base/copy' );
3637
var format = require( '@stdlib/string/format' );
3738
var validate = require( './validate.js' );
3839

@@ -98,8 +99,8 @@ function Unary( fcn, idtypes, odtypes, policy ) {
9899
throw new TypeError( format( 'invalid argument. Fourth argument must be a supported output data type policy. Value: `%s`.', policy ) );
99100
}
100101
this._fcn = fcn;
101-
this._idtypes = idtypes;
102-
this._odtypes = odtypes;
102+
this._idtypes = copy( idtypes );
103+
this._odtypes = copy( odtypes );
103104
this._policy = policy;
104105
return this;
105106
}

0 commit comments

Comments
 (0)