Skip to content

Commit b8eaf74

Browse files
committed
fix: address missing attribute and relax brand checks
--- 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 f4a90b1 commit b8eaf74

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

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

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

2121
// MODULES //
2222

23-
var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimitive;
2423
var isDataView = require( '@stdlib/assert/is-dataview' );
2524
var isObject = require( '@stdlib/assert/is-object' );
26-
var CTOR_NAME = require( './ctor_name.js' );
2725
var PRIVATE_BUFFER = require( './private_buffer.js' );
2826

2927

@@ -40,8 +38,6 @@ function isStruct( value ) {
4038
// NOTE: the following is a relatively weak test, but we cannot use `instanceof` checks, etc, due to the factory nature of the implementation. Regardless, here, we are just trying to sniff out a `struct` type. If calling as a constructor later fails, we punt the responsibility off to the user to handle what should be an edge case. If, in the future, this check proves insufficient, we can add further "brand" checks...
4139
return (
4240
isObject( value ) &&
43-
value.constructor.name === CTOR_NAME &&
44-
isPositiveInteger( value.constructor.byteLength ) &&
4541
isDataView( value[ PRIVATE_BUFFER ] )
4642
);
4743
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ function factory( fields ) {
413413
throw new TypeError( format( 'invalid argument. First argument must be a `struct` instance. Value: `%s`.', obj ) );
414414
}
415415
buf = obj[ PRIVATE_BUFFER ];
416-
return new DataView( buf, buf.byteOffset, buf.byteLength );
416+
return new DataView( buf.buffer, buf.byteOffset, buf.byteLength );
417417
});
418418

419419
// Create prototype accessors for getting and setting field values:

0 commit comments

Comments
 (0)