Skip to content

Commit 6cfb626

Browse files
committed
refactor: use utility to set properties
--- 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 29270fb commit 6cfb626

File tree

1 file changed

+3
-13
lines changed
  • lib/node_modules/@stdlib/complex/float32/ctor/lib

1 file changed

+3
-13
lines changed

lib/node_modules/@stdlib/complex/float32/ctor/lib/main.js

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// MODULES //
2222

2323
var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive;
24-
var defineProperty = require( '@stdlib/utils/define-property' );
24+
var setEnumerableReadOnly = require( '@stdlib/utils/define-read-only-property' );
2525
var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
2626
var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
2727
var format = require( '@stdlib/string/format' );
@@ -56,18 +56,8 @@ function Complex64( real, imag ) {
5656
if ( !isNumber( imag ) ) {
5757
throw new TypeError( format( 'invalid argument. Imaginary component must be a number. Value: `%s`.', imag ) );
5858
}
59-
defineProperty( this, 're', {
60-
'configurable': false,
61-
'enumerable': true,
62-
'writable': false,
63-
'value': float64ToFloat32( real )
64-
});
65-
defineProperty( this, 'im', {
66-
'configurable': false,
67-
'enumerable': true,
68-
'writable': false,
69-
'value': float64ToFloat32( imag )
70-
});
59+
setEnumerableReadOnly( this, 're', float64ToFloat32( real ) );
60+
setEnumerableReadOnly( this, 'im', float64ToFloat32( imag ) );
7161
return this;
7262
}
7363

0 commit comments

Comments
 (0)