@stdlib/complex-base 0.3.0 → 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,7 +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 (i.e., lower-level) complex number assertion functions.</span>
71
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>
72
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>
73
75
 
74
76
  </div>
@@ -140,7 +142,7 @@ See [LICENSE][stdlib-license].
140
142
 
141
143
  ## Copyright
142
144
 
143
- Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
145
+ Copyright &copy; 2016-2026. The Stdlib [Authors][stdlib-authors].
144
146
 
145
147
  </section>
146
148
 
@@ -153,8 +155,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
153
155
  [npm-image]: http://img.shields.io/npm/v/@stdlib/complex-base.svg
154
156
  [npm-url]: https://npmjs.org/package/@stdlib/complex-base
155
157
 
156
- [test-image]: https://github.com/stdlib-js/complex-base/actions/workflows/test.yml/badge.svg?branch=v0.3.0
157
- [test-url]: https://github.com/stdlib-js/complex-base/actions/workflows/test.yml?query=branch:v0.3.0
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
158
160
 
159
161
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/complex-base/main.svg
160
162
  [coverage-url]: https://codecov.io/github/stdlib-js/complex-base?branch=main
@@ -166,8 +168,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
166
168
 
167
169
  -->
168
170
 
169
- [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
170
- [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
171
173
 
172
174
  [stdlib]: https://github.com/stdlib-js/stdlib
173
175
 
@@ -188,8 +190,12 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
188
190
 
189
191
  <!-- <toc-links> -->
190
192
 
193
+ [@stdlib/complex/base/assert]: https://www.npmjs.com/package/@stdlib/complex-base-assert
194
+
191
195
  [@stdlib/complex/base/cast-return]: https://www.npmjs.com/package/@stdlib/complex-base-cast-return
192
196
 
197
+ [@stdlib/complex/base/parse]: https://www.npmjs.com/package/@stdlib/complex-base-parse
198
+
193
199
  [@stdlib/complex/base/wrap-function]: https://www.npmjs.com/package/@stdlib/complex-base-wrap-function
194
200
 
195
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,"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 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,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
  }
@@ -20,13 +20,20 @@
20
20
 
21
21
  /* eslint-disable max-lines */
22
22
 
23
+ import assert = require( '@stdlib/complex-base-assert' );
23
24
  import cast = require( '@stdlib/complex-base-cast-return' );
25
+ import parse = require( '@stdlib/complex-base-parse' );
24
26
  import wrap = require( '@stdlib/complex-base-wrap-function' );
25
27
 
26
28
  /**
27
29
  * Interface describing the `base` namespace.
28
30
  */
29
31
  interface Namespace {
32
+ /**
33
+ * Base (i.e., lower-level) complex number assertion functions.
34
+ */
35
+ assert: typeof assert;
36
+
30
37
  /**
31
38
  * Wraps an n-ary function and casts a function's return value to a complex number.
32
39
  *
@@ -43,8 +50,6 @@ interface Namespace {
43
50
  *
44
51
  * @example
45
52
  * var Complex64 = require( '@stdlib/complex-float32-ctor' );
46
- * var realf = require( '@stdlib/complex-float32-real' );
47
- * var imagf = require( '@stdlib/complex-float32-imag' );
48
53
  *
49
54
  * function add( x, y, z, w, v, t ) {
50
55
  * return x + y + z + w + v + t;
@@ -55,15 +60,23 @@ interface Namespace {
55
60
  * // ...
56
61
  *
57
62
  * var z = f( 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 );
58
- * // 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.
59
69
  *
60
- * var re = realf( z );
61
- * // returns 33.0
70
+ * @param str - input string
71
+ * @returns complex like object
62
72
  *
63
- * var im = imagf( z );
64
- * // returns 0.0
73
+ * @example
74
+ * var str = '4 + 6i';
75
+ *
76
+ * var z = ns.parse( str );
77
+ * // returns { 're' : 4, 'im' : 6 }
65
78
  */
66
- cast: typeof cast;
79
+ parse: typeof parse;
67
80
 
68
81
  /**
69
82
  * Wraps an n-ary function accepting complex number arguments to support providing both real and complex numbers.
package/lib/index.js CHANGED
@@ -36,6 +36,15 @@ var setReadOnly = require( '@stdlib/utils-define-read-only-property' );
36
36
  */
37
37
  var ns = {};
38
38
 
39
+ /**
40
+ * @name assert
41
+ * @memberof ns
42
+ * @readonly
43
+ * @type {Namespace}
44
+ * @see {@link module:@stdlib/complex/base/assert}
45
+ */
46
+ setReadOnly( ns, 'assert', require( '@stdlib/complex-base-assert' ) );
47
+
39
48
  /**
40
49
  * @name cast
41
50
  * @memberof ns
@@ -45,6 +54,15 @@ var ns = {};
45
54
  */
46
55
  setReadOnly( ns, 'cast', require( '@stdlib/complex-base-cast-return' ) );
47
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
+
48
66
  /**
49
67
  * @name wrap
50
68
  * @memberof ns
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/complex-base",
3
- "version": "0.3.0",
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": {
@@ -30,8 +30,10 @@
30
30
  "url": "https://github.com/stdlib-js/stdlib/issues"
31
31
  },
32
32
  "dependencies": {
33
- "@stdlib/complex-base-cast-return": "^0.2.1",
34
- "@stdlib/complex-base-wrap-function": "^0.2.1",
33
+ "@stdlib/complex-base-assert": "^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",
35
37
  "@stdlib/utils-define-read-only-property": "^0.2.2"
36
38
  },
37
39
  "devDependencies": {},