Skip to content

Commit 19c80d8

Browse files
committed
feat: add constructor name property
--- 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: passed - 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 6cfb626 commit 19c80d8

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,21 @@ function Complex64( real, imag ) {
6161
return this;
6262
}
6363

64+
/**
65+
* Constructor name.
66+
*
67+
* @name name
68+
* @memberof Complex64
69+
* @readonly
70+
* @type {string}
71+
* @default 'Complex64'
72+
*
73+
* @example
74+
* var name = Complex64.name;
75+
* // returns 'Complex64'
76+
*/
77+
setReadOnly( Complex64, 'name', 'Complex64' );
78+
6479
/**
6580
* Size (in bytes) of each component.
6681
*

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,17 @@ tape( 'the constructor requires the `new` keyword', function test( t ) {
101101
}
102102
});
103103

104+
tape( 'the constructor has a read-only `name` property', function test( t ) {
105+
t.strictEqual( hasOwnProp( Complex64, 'name' ), true, 'has property' );
106+
t.strictEqual( Complex64.name, 'Complex64', 'returns expected value' );
107+
t.throws( foo, Error, 'throws an error' );
108+
t.end();
109+
110+
function foo() {
111+
Complex64.name = 'Foo';
112+
}
113+
});
114+
104115
tape( 'the constructor has a read-only `BYTES_PER_ELEMENT` property', function test( t ) {
105116
t.strictEqual( hasOwnProp( Complex64, 'BYTES_PER_ELEMENT' ), true, 'has property' );
106117
t.strictEqual( Complex64.BYTES_PER_ELEMENT, 4, 'returns expected value' );

0 commit comments

Comments
 (0)