Skip to content

Commit 2eaea4a

Browse files
committed
fix: add type check to ensure only options objects are passed to factory
--- 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 6fcba80 commit 2eaea4a

File tree

1 file changed

+3
-0
lines changed
  • lib/node_modules/@stdlib/random/tools/unary-factory/lib

1 file changed

+3
-0
lines changed

lib/node_modules/@stdlib/random/tools/unary-factory/lib/main.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@ function createFactory( prng, idtypes, odtypes, policies, options ) {
172172

173173
if ( arguments.length > 0 ) {
174174
opts = arguments[ 0 ];
175+
if ( !isPlainObject( opts ) ) {
176+
throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', opts ) );
177+
}
175178
base = prng.factory( opts );
176179
} else {
177180
opts = {};

0 commit comments

Comments
 (0)