Skip to content

Commit 76ebd1b

Browse files
committed
refactor: use assert utility
--- 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 0ba0d91 commit 76ebd1b

File tree

3 files changed

+4
-55
lines changed

3 files changed

+4
-55
lines changed

lib/node_modules/@stdlib/dstructs/struct/lib/is_struct_type.js

Lines changed: 0 additions & 51 deletions
This file was deleted.

lib/node_modules/@stdlib/dstructs/struct/lib/is_valid_type.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020

2121
// MODULES //
2222

23+
var isStructConstructorLike = require( '@stdlib/assert/is-struct-constructor-like' );
2324
var contains = require( '@stdlib/array/base/assert/contains' );
2425
var join = require( '@stdlib/array/base/join' );
2526
var format = require( '@stdlib/string/format' );
26-
var isStructType = require( './is_struct_type.js' );
2727
var DTYPES = require( './dtypes.js' );
2828

2929

@@ -37,7 +37,7 @@ var DTYPES = require( './dtypes.js' );
3737
* @returns {(null|TypeError)} error object or null
3838
*/
3939
function isValidType( value ) {
40-
if ( contains( DTYPES, value ) || isStructType( value ) ) {
40+
if ( contains( DTYPES, value ) || isStructConstructorLike( value ) ) {
4141
return null;
4242
}
4343
return new TypeError( format( 'invalid argument. `%s` field must be either a struct type or one of the following: "%s". Value: `%s`.', 'type', join( DTYPES, ', ' ), value ) );

lib/node_modules/@stdlib/dstructs/struct/lib/normalize_field.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020

2121
// MODULES //
2222

23+
var isStructConstructorLike = require( '@stdlib/assert/is-struct-constructor-like' );
2324
var hasProp = require( '@stdlib/assert/has-property' );
2425
var join = require( '@stdlib/array/base/join' );
2526
var constantFunction = require( '@stdlib/utils/constant-function' );
2627
var format = require( '@stdlib/string/format' );
2728
var hasProperties = require( './has_properties.js' );
28-
var isStructType = require( './is_struct_type.js' );
2929
var isValidNonEmptyString = require( './is_valid_nonempty_string.js' );
3030
var isValidString = require( './is_valid_string.js' );
3131
var isValidPositiveInteger = require( './is_valid_positive_integer.js' );
@@ -89,7 +89,7 @@ function normalize( obj, keys ) {
8989
if ( !hasProperties( out, MANDATORY_FIELD_NAMES ) ) {
9090
return new TypeError( format( 'invalid argument. Field objects must have the following properties: "%s". Value: `%s`.', join( MANDATORY_FIELD_NAMES, ', ' ), JSON.stringify( obj ) ) );
9191
}
92-
out.isStructType = isStructType( out.type );
92+
out.isStructType = isStructConstructorLike( out.type );
9393
out.byteLength = byteLength( out );
9494
if ( out.isStructType ) {
9595
out.alignment = out.type.alignment;

0 commit comments

Comments
 (0)