@stdlib/complex-base 0.2.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/NOTICE CHANGED
@@ -1 +1 @@
1
- Copyright (c) 2016-2024 The Stdlib Authors.
1
+ Copyright (c) 2016-2026 The Stdlib Authors.
package/README.md CHANGED
@@ -68,8 +68,9 @@ The namespace contains the following functions:
68
68
 
69
69
  <div class="namespace-toc">
70
70
 
71
- - <span class="signature">[`assert`][@stdlib/complex/base/assert]</span><span class="delimiter">: </span><span class="description">base complex number assert functions.</span>
71
+ - <span class="signature">[`assert`][@stdlib/complex/base/assert]</span><span class="delimiter">: </span><span class="description">base (i.e., lower-level) complex number assertion functions.</span>
72
72
  - <span class="signature">[`cast( fcn, nargs, ctor )`][@stdlib/complex/base/cast-return]</span><span class="delimiter">: </span><span class="description">wrap a function and cast a function's return value to a complex number.</span>
73
+ - <span class="signature">[`parse( str )`][@stdlib/complex/base/parse]</span><span class="delimiter">: </span><span class="description">parses a string representing a complex number into a complex like object `{re: number, im: number}`.</span>
73
74
  - <span class="signature">[`wrap( fcn, nargs, ctor )`][@stdlib/complex/base/wrap-function]</span><span class="delimiter">: </span><span class="description">wrap a function accepting complex number arguments to support providing both real and complex numbers.</span>
74
75
 
75
76
  </div>
@@ -141,7 +142,7 @@ See [LICENSE][stdlib-license].
141
142
 
142
143
  ## Copyright
143
144
 
144
- Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
145
+ Copyright &copy; 2016-2026. The Stdlib [Authors][stdlib-authors].
145
146
 
146
147
  </section>
147
148
 
@@ -154,8 +155,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
154
155
  [npm-image]: http://img.shields.io/npm/v/@stdlib/complex-base.svg
155
156
  [npm-url]: https://npmjs.org/package/@stdlib/complex-base
156
157
 
157
- [test-image]: https://github.com/stdlib-js/complex-base/actions/workflows/test.yml/badge.svg?branch=v0.2.1
158
- [test-url]: https://github.com/stdlib-js/complex-base/actions/workflows/test.yml?query=branch:v0.2.1
158
+ [test-image]: https://github.com/stdlib-js/complex-base/actions/workflows/test.yml/badge.svg?branch=v0.4.0
159
+ [test-url]: https://github.com/stdlib-js/complex-base/actions/workflows/test.yml?query=branch:v0.4.0
159
160
 
160
161
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/complex-base/main.svg
161
162
  [coverage-url]: https://codecov.io/github/stdlib-js/complex-base?branch=main
@@ -167,8 +168,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
167
168
 
168
169
  -->
169
170
 
170
- [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
171
- [chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
171
+ [chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
172
+ [chat-url]: https://stdlib.zulipchat.com
172
173
 
173
174
  [stdlib]: https://github.com/stdlib-js/stdlib
174
175
 
@@ -193,6 +194,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
193
194
 
194
195
  [@stdlib/complex/base/cast-return]: https://www.npmjs.com/package/@stdlib/complex-base-cast-return
195
196
 
197
+ [@stdlib/complex/base/parse]: https://www.npmjs.com/package/@stdlib/complex-base-parse
198
+
196
199
  [@stdlib/complex/base/wrap-function]: https://www.npmjs.com/package/@stdlib/complex-base-wrap-function
197
200
 
198
201
  <!-- </toc-links> -->
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";var e=require('@stdlib/utils-define-read-only-property/dist'),r={};e(r,"assert",require('@stdlib/complex-base-assert/dist'));e(r,"cast",require('@stdlib/complex-base-cast-return/dist'));e(r,"wrap",require('@stdlib/complex-base-wrap-function/dist'));module.exports=r;
1
+ "use strict";var e=require('@stdlib/utils-define-read-only-property/dist'),r={};e(r,"assert",require('@stdlib/complex-base-assert/dist'));e(r,"cast",require('@stdlib/complex-base-cast-return/dist'));e(r,"parse",require('@stdlib/complex-base-parse/dist'));e(r,"wrap",require('@stdlib/complex-base-wrap-function/dist'));module.exports=r;
2
2
  /** @license Apache-2.0 */
3
3
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../lib/index.js"],
4
- "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/*\n* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name.\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-read-only-property' );\n\n\n// MAIN //\n\n/**\n* Top-level namespace.\n*\n* @namespace ns\n*/\nvar ns = {};\n\n/**\n* @name assert\n* @memberof ns\n* @readonly\n* @type {Namespace}\n* @see {@link module:@stdlib/complex/base/assert}\n*/\nsetReadOnly( ns, 'assert', require( '@stdlib/complex-base-assert' ) );\n\n/**\n* @name cast\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/complex/base/cast-return}\n*/\nsetReadOnly( ns, 'cast', require( '@stdlib/complex-base-cast-return' ) );\n\n/**\n* @name wrap\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/complex/base/wrap-function}\n*/\nsetReadOnly( ns, 'wrap', require( '@stdlib/complex-base-wrap-function' ) );\n\n\n// EXPORTS //\n\nmodule.exports = ns;\n"],
5
- "mappings": "aA0BA,IAAIA,EAAc,QAAS,yCAA0C,EAUjEC,EAAK,CAAC,EASVD,EAAaC,EAAI,SAAU,QAAS,6BAA8B,CAAE,EASpED,EAAaC,EAAI,OAAQ,QAAS,kCAAmC,CAAE,EASvED,EAAaC,EAAI,OAAQ,QAAS,oCAAqC,CAAE,EAKzE,OAAO,QAAUA",
4
+ "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/*\n* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name.\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-read-only-property' );\n\n\n// MAIN //\n\n/**\n* Top-level namespace.\n*\n* @namespace ns\n*/\nvar ns = {};\n\n/**\n* @name assert\n* @memberof ns\n* @readonly\n* @type {Namespace}\n* @see {@link module:@stdlib/complex/base/assert}\n*/\nsetReadOnly( ns, 'assert', require( '@stdlib/complex-base-assert' ) );\n\n/**\n* @name cast\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/complex/base/cast-return}\n*/\nsetReadOnly( ns, 'cast', require( '@stdlib/complex-base-cast-return' ) );\n\n/**\n* @name parse\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/complex/base/parse}\n*/\nsetReadOnly( ns, 'parse', require( '@stdlib/complex-base-parse' ) );\n\n/**\n* @name wrap\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/complex/base/wrap-function}\n*/\nsetReadOnly( ns, 'wrap', require( '@stdlib/complex-base-wrap-function' ) );\n\n\n// EXPORTS //\n\nmodule.exports = ns;\n"],
5
+ "mappings": "aA0BA,IAAIA,EAAc,QAAS,yCAA0C,EAUjEC,EAAK,CAAC,EASVD,EAAaC,EAAI,SAAU,QAAS,6BAA8B,CAAE,EASpED,EAAaC,EAAI,OAAQ,QAAS,kCAAmC,CAAE,EASvED,EAAaC,EAAI,QAAS,QAAS,4BAA6B,CAAE,EASlED,EAAaC,EAAI,OAAQ,QAAS,oCAAqC,CAAE,EAKzE,OAAO,QAAUA",
6
6
  "names": ["setReadOnly", "ns"]
7
7
  }
@@ -22,6 +22,7 @@
22
22
 
23
23
  import assert = require( '@stdlib/complex-base-assert' );
24
24
  import cast = require( '@stdlib/complex-base-cast-return' );
25
+ import parse = require( '@stdlib/complex-base-parse' );
25
26
  import wrap = require( '@stdlib/complex-base-wrap-function' );
26
27
 
27
28
  /**
@@ -29,7 +30,7 @@ import wrap = require( '@stdlib/complex-base-wrap-function' );
29
30
  */
30
31
  interface Namespace {
31
32
  /**
32
- * Base complex number assert functions.
33
+ * Base (i.e., lower-level) complex number assertion functions.
33
34
  */
34
35
  assert: typeof assert;
35
36
 
@@ -48,9 +49,7 @@ interface Namespace {
48
49
  * @returns wrapped function
49
50
  *
50
51
  * @example
51
- * var Complex64 = require( '@stdlib/complex-float32' );
52
- * var realf = require( '@stdlib/complex-realf' );
53
- * var imagf = require( '@stdlib/complex-imagf' );
52
+ * var Complex64 = require( '@stdlib/complex-float32-ctor' );
54
53
  *
55
54
  * function add( x, y, z, w, v, t ) {
56
55
  * return x + y + z + w + v + t;
@@ -61,15 +60,23 @@ interface Namespace {
61
60
  * // ...
62
61
  *
63
62
  * var z = f( 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 );
64
- * // returns <Complex64>
63
+ * // returns <Complex64>[ 33.0, 0.0 ]
64
+ */
65
+ cast: typeof cast;
66
+
67
+ /**
68
+ * Parses a string representing a complex number into a complex like object.
65
69
  *
66
- * var re = realf( z );
67
- * // returns 33.0
70
+ * @param str - input string
71
+ * @returns complex like object
68
72
  *
69
- * var im = imagf( z );
70
- * // returns 0.0
73
+ * @example
74
+ * var str = '4 + 6i';
75
+ *
76
+ * var z = ns.parse( str );
77
+ * // returns { 're' : 4, 'im' : 6 }
71
78
  */
72
- cast: typeof cast;
79
+ parse: typeof parse;
73
80
 
74
81
  /**
75
82
  * Wraps an n-ary function accepting complex number arguments to support providing both real and complex numbers.
@@ -86,9 +93,9 @@ interface Namespace {
86
93
  * @returns wrapped function
87
94
  *
88
95
  * @example
89
- * var Complex64 = require( '@stdlib/complex-float32' );
90
- * var realf = require( '@stdlib/complex-realf' );
91
- * var imagf = require( '@stdlib/complex-imagf' );
96
+ * var Complex64 = require( '@stdlib/complex-float32-ctor' );
97
+ * var realf = require( '@stdlib/complex-float32-real' );
98
+ * var imagf = require( '@stdlib/complex-float32-imag' );
92
99
  *
93
100
  * function add( x, y, z, w, v, t ) {
94
101
  * var re = realf( x ) + realf( y ) + realf( z ) + realf( w ) + realf( v ) + realf( t );
package/lib/index.js CHANGED
@@ -54,6 +54,15 @@ setReadOnly( ns, 'assert', require( '@stdlib/complex-base-assert' ) );
54
54
  */
55
55
  setReadOnly( ns, 'cast', require( '@stdlib/complex-base-cast-return' ) );
56
56
 
57
+ /**
58
+ * @name parse
59
+ * @memberof ns
60
+ * @readonly
61
+ * @type {Function}
62
+ * @see {@link module:@stdlib/complex/base/parse}
63
+ */
64
+ setReadOnly( ns, 'parse', require( '@stdlib/complex-base-parse' ) );
65
+
57
66
  /**
58
67
  * @name wrap
59
68
  * @memberof ns
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/complex-base",
3
- "version": "0.2.1",
3
+ "version": "0.4.0",
4
4
  "description": "Base (i.e., lower-level) complex number functions.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -31,9 +31,10 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@stdlib/complex-base-assert": "^0.2.1",
34
- "@stdlib/complex-base-cast-return": "^0.2.1",
35
- "@stdlib/complex-base-wrap-function": "^0.2.1",
36
- "@stdlib/utils-define-read-only-property": "^0.2.1"
34
+ "@stdlib/complex-base-cast-return": "^0.2.2",
35
+ "@stdlib/complex-base-parse": "^0.1.1",
36
+ "@stdlib/complex-base-wrap-function": "^0.2.2",
37
+ "@stdlib/utils-define-read-only-property": "^0.2.2"
37
38
  },
38
39
  "devDependencies": {},
39
40
  "engines": {