Skip to content

Commit 565a2ff

Browse files
committed
feat!: refactor namespace to export subnamespaces
BREAKING CHANGE: APIs renamed and/or moved to subnamespaces To migrate, users should consult the list of exports to determine which properties moved where. Double-precision APIs moved to the `float64` namespace and single-precision APIs moved to the `float32` namespace. The following properties were renamed: - complexCtors => ctors - complexDataType => dtype - complexDataTypes => dtypes - complexPromotionRules => promotionRules
1 parent ea241a3 commit 565a2ff

File tree

2 files changed

+18
-197
lines changed

2 files changed

+18
-197
lines changed

Diff for: lib/node_modules/@stdlib/complex/README.md

+2-91
Original file line numberDiff line numberDiff line change
@@ -39,67 +39,12 @@ var o = ns;
3939
// returns {...}
4040
```
4141

42-
The namespace constains complex number constructors.
42+
The namespace contains the following APIs:
4343

44-
<!-- <toc keywords="+data, +structure, +types"> -->
45-
46-
<div class="namespace-toc">
47-
48-
- <span class="signature">[`base`][@stdlib/complex/base]</span><span class="delimiter">: </span><span class="description">base (i.e., lower-level) complex number functions.</span>
49-
- <span class="signature">[`complex( real, imag[, dtype] )`][@stdlib/complex/cmplx]</span><span class="delimiter">: </span><span class="description">create a complex number.</span>
50-
- <span class="signature">[`complexCtors( dtype )`][@stdlib/complex/ctors]</span><span class="delimiter">: </span><span class="description">complex number constructors.</span>
51-
- <span class="signature">[`complexDataType( value )`][@stdlib/complex/dtype]</span><span class="delimiter">: </span><span class="description">return the data type of a complex number.</span>
52-
- <span class="signature">[`complexDataTypes()`][@stdlib/complex/dtypes]</span><span class="delimiter">: </span><span class="description">list of complex number data types.</span>
53-
- <span class="signature">[`complexPromotionRules( [dtype1, dtype2] )`][@stdlib/complex/promotion-rules]</span><span class="delimiter">: </span><span class="description">return the complex number data type with the smallest size and closest "kind" to which data types can be **safely** cast.</span>
54-
55-
</div>
44+
<!-- <toc pattern="*"> -->
5645

5746
<!-- </toc> -->
5847

59-
```javascript
60-
var z = ns.complex( 5.0, 3.0 );
61-
// returns <Complex128>
62-
63-
var str = z.toString();
64-
// returns '5 + 3i'
65-
66-
z = ns.complex( 5.0, 3.0, 'float32' );
67-
// returns <Complex64>
68-
69-
z = new ns.Complex64( 5.0, 3.0 );
70-
// returns <Complex64>
71-
```
72-
73-
In addition, the namespace contains the following functions:
74-
75-
<!-- <toc keywords="-data, -structure, -types"> -->
76-
77-
<div class="namespace-toc">
78-
79-
- <span class="signature">[`conj( z )`][@stdlib/complex/float64/conj]</span><span class="delimiter">: </span><span class="description">return the complex conjugate of a double-precision complex floating-point number.</span>
80-
- <span class="signature">[`conjf( z )`][@stdlib/complex/float32/conj]</span><span class="delimiter">: </span><span class="description">return the complex conjugate of a single-precision complex floating-point number.</span>
81-
- <span class="signature">[`imag( z )`][@stdlib/complex/float64/imag]</span><span class="delimiter">: </span><span class="description">return the imaginary component of a double-precision complex floating-point number.</span>
82-
- <span class="signature">[`imagf( z )`][@stdlib/complex/float32/imag]</span><span class="delimiter">: </span><span class="description">return the imaginary component of a single-precision complex floating-point number.</span>
83-
- <span class="signature">[`real( z )`][@stdlib/complex/float64/real]</span><span class="delimiter">: </span><span class="description">return the real component of a double-precision complex floating-point number.</span>
84-
- <span class="signature">[`realf( z )`][@stdlib/complex/float32/real]</span><span class="delimiter">: </span><span class="description">return the real component of a single-precision complex floating-point number.</span>
85-
- <span class="signature">[`reim( z )`][@stdlib/complex/float64/reim]</span><span class="delimiter">: </span><span class="description">return the real and imaginary components of a double-precision complex floating-point number.</span>
86-
- <span class="signature">[`reimf( z )`][@stdlib/complex/float32/reim]</span><span class="delimiter">: </span><span class="description">return the real and imaginary components of a single-precision complex floating-point number.</span>
87-
- <span class="signature">[`reviveComplex( key, value )`][@stdlib/complex/reviver]</span><span class="delimiter">: </span><span class="description">revive a JSON-serialized complex number.</span>
88-
89-
</div>
90-
91-
<!-- </toc> -->
92-
93-
```javascript
94-
var z = ns.complex( 5.0, 3.0 );
95-
var str = z.toString();
96-
// returns '5 + 3i'
97-
98-
var v = ns.conj( z );
99-
str = v.toString();
100-
// returns '5 - 3i'
101-
```
102-
10348
</section>
10449

10550
<!-- /.usage -->
@@ -135,40 +80,6 @@ console.log( objectKeys( ns ) );
13580

13681
<section class="links">
13782

138-
<!-- <toc-links> -->
139-
140-
[@stdlib/complex/float64/conj]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/conj
141-
142-
[@stdlib/complex/float32/conj]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float32/conj
143-
144-
[@stdlib/complex/float64/imag]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/imag
145-
146-
[@stdlib/complex/float32/imag]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float32/imag
147-
148-
[@stdlib/complex/float64/real]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/real
149-
150-
[@stdlib/complex/float32/real]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float32/real
151-
152-
[@stdlib/complex/float64/reim]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/reim
153-
154-
[@stdlib/complex/float32/reim]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float32/reim
155-
156-
[@stdlib/complex/reviver]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/reviver
157-
158-
[@stdlib/complex/base]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/base
159-
160-
[@stdlib/complex/cmplx]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/cmplx
161-
162-
[@stdlib/complex/ctors]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/ctors
163-
164-
[@stdlib/complex/dtype]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/dtype
165-
166-
[@stdlib/complex/dtypes]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/dtypes
167-
168-
[@stdlib/complex/promotion-rules]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/promotion-rules
169-
170-
<!-- </toc-links> -->
171-
17283
</section>
17384

17485
<!-- /.links -->

Diff for: lib/node_modules/@stdlib/complex/lib/index.js

+16-106
Original file line numberDiff line numberDiff line change
@@ -55,148 +55,58 @@ setReadOnly( ns, 'base', require( '@stdlib/complex/base' ) );
5555
setReadOnly( ns, 'complex', require( '@stdlib/complex/cmplx' ) );
5656

5757
/**
58-
* @name complexCtors
58+
* @name ctors
5959
* @memberof ns
6060
* @readonly
6161
* @type {Function}
6262
* @see {@link module:@stdlib/complex/ctors}
6363
*/
64-
setReadOnly( ns, 'complexCtors', require( '@stdlib/complex/ctors' ) );
64+
setReadOnly( ns, 'ctors', require( '@stdlib/complex/ctors' ) );
6565

6666
/**
67-
* @name complexDataType
67+
* @name dtype
6868
* @memberof ns
6969
* @readonly
7070
* @type {Function}
7171
* @see {@link module:@stdlib/complex/dtype}
7272
*/
73-
setReadOnly( ns, 'complexDataType', require( '@stdlib/complex/dtype' ) );
73+
setReadOnly( ns, 'dtype', require( '@stdlib/complex/dtype' ) );
7474

7575
/**
76-
* @name complexDataTypes
76+
* @name dtypes
7777
* @memberof ns
7878
* @readonly
7979
* @type {Function}
8080
* @see {@link module:@stdlib/complex/dtypes}
8181
*/
82-
setReadOnly( ns, 'complexDataTypes', require( '@stdlib/complex/dtypes' ) );
82+
setReadOnly( ns, 'dtypes', require( '@stdlib/complex/dtypes' ) );
8383

8484
/**
85-
* @name conjf
85+
* @name float32
8686
* @memberof ns
8787
* @readonly
88-
* @type {Function}
89-
* @see {@link module:@stdlib/complex/float32/conj}
90-
*/
91-
setReadOnly( ns, 'conjf', require( '@stdlib/complex/float32/conj' ) );
92-
93-
/**
94-
* @name Complex64
95-
* @memberof ns
96-
* @readonly
97-
* @constructor
98-
* @see {@link module:@stdlib/complex/float32/ctor}
99-
*/
100-
setReadOnly( ns, 'Complex64', require( '@stdlib/complex/float32/ctor' ) );
101-
102-
/**
103-
* @name imagf
104-
* @memberof ns
105-
* @readonly
106-
* @type {Function}
107-
* @see {@link module:@stdlib/complex/float32/imag}
108-
*/
109-
setReadOnly( ns, 'imagf', require( '@stdlib/complex/float32/imag' ) );
110-
111-
/**
112-
* @name realf
113-
* @memberof ns
114-
* @readonly
115-
* @type {Function}
116-
* @see {@link module:@stdlib/complex/float32/real}
117-
*/
118-
setReadOnly( ns, 'realf', require( '@stdlib/complex/float32/real' ) );
119-
120-
/**
121-
* @name reimf
122-
* @memberof ns
123-
* @readonly
124-
* @type {Function}
125-
* @see {@link module:@stdlib/complex/float32/reim}
126-
*/
127-
setReadOnly( ns, 'reimf', require( '@stdlib/complex/float32/reim' ) );
128-
129-
/**
130-
* @name reviveComplex64
131-
* @memberof ns
132-
* @readonly
133-
* @type {Function}
134-
* @see {@link module:@stdlib/complex/float32/reviver}
135-
*/
136-
setReadOnly( ns, 'reviveComplex64', require( '@stdlib/complex/float32/reviver' ) );
137-
138-
/**
139-
* @name conj
140-
* @memberof ns
141-
* @readonly
142-
* @type {Function}
143-
* @see {@link module:@stdlib/complex/float64/conj}
144-
*/
145-
setReadOnly( ns, 'conj', require( '@stdlib/complex/float64/conj' ) );
146-
147-
/**
148-
* @name Complex128
149-
* @memberof ns
150-
* @readonly
151-
* @constructor
152-
* @see {@link module:@stdlib/complex/float64/ctor}
153-
*/
154-
setReadOnly( ns, 'Complex128', require( '@stdlib/complex/float64/ctor' ) );
155-
156-
/**
157-
* @name imag
158-
* @memberof ns
159-
* @readonly
160-
* @type {Function}
161-
* @see {@link module:@stdlib/complex/float64/imag}
162-
*/
163-
setReadOnly( ns, 'imag', require( '@stdlib/complex/float64/imag' ) );
164-
165-
/**
166-
* @name real
167-
* @memberof ns
168-
* @readonly
169-
* @type {Function}
170-
* @see {@link module:@stdlib/complex/float64/real}
171-
*/
172-
setReadOnly( ns, 'real', require( '@stdlib/complex/float64/real' ) );
173-
174-
/**
175-
* @name reim
176-
* @memberof ns
177-
* @readonly
178-
* @type {Function}
179-
* @see {@link module:@stdlib/complex/float64/reim}
88+
* @type {Namespace}
89+
* @see {@link module:@stdlib/complex/float32}
18090
*/
181-
setReadOnly( ns, 'reim', require( '@stdlib/complex/float64/reim' ) );
91+
setReadOnly( ns, 'float32', require( '@stdlib/complex/float32' ) );
18292

18393
/**
184-
* @name reviveComplex128
94+
* @name float64
18595
* @memberof ns
18696
* @readonly
187-
* @type {Function}
188-
* @see {@link module:@stdlib/complex/float64/reviver}
97+
* @type {Namespace}
98+
* @see {@link module:@stdlib/complex/float64}
18999
*/
190-
setReadOnly( ns, 'reviveComplex128', require( '@stdlib/complex/float64/reviver' ) );
100+
setReadOnly( ns, 'float64', require( '@stdlib/complex/float64' ) );
191101

192102
/**
193-
* @name complexPromotionRules
103+
* @name promotionRules
194104
* @memberof ns
195105
* @readonly
196106
* @type {Function}
197107
* @see {@link module:@stdlib/complex/promotion-rules}
198108
*/
199-
setReadOnly( ns, 'complexPromotionRules', require( '@stdlib/complex/promotion-rules' ) );
109+
setReadOnly( ns, 'promotionRules', require( '@stdlib/complex/promotion-rules' ) );
200110

201111
/**
202112
* @name reviveComplex

0 commit comments

Comments
 (0)