@stdlib/ndarray-base-dtypes2signatures 0.0.3 → 0.0.7

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-2021 The Stdlib Authors.
1
+ Copyright (c) 2016-2022 The Stdlib Authors.
package/README.md CHANGED
@@ -20,7 +20,7 @@ limitations under the License.
20
20
 
21
21
  # dtypes2signatures
22
22
 
23
- [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] [![dependencies][dependencies-image]][dependencies-url]
23
+ [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
24
24
 
25
25
  > Transform a list of array argument data types into a list of signatures.
26
26
 
@@ -176,6 +176,14 @@ console.log( sigs );
176
176
 
177
177
  <!-- /.references -->
178
178
 
179
+ <!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
180
+
181
+ <section class="related">
182
+
183
+ </section>
184
+
185
+ <!-- /.related -->
186
+
179
187
  <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
180
188
 
181
189
 
@@ -189,6 +197,10 @@ This package is part of [stdlib][stdlib], a standard library for JavaScript and
189
197
 
190
198
  For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib].
191
199
 
200
+ #### Community
201
+
202
+ [![Chat][chat-image]][chat-url]
203
+
192
204
  ---
193
205
 
194
206
  ## License
@@ -198,7 +210,7 @@ See [LICENSE][stdlib-license].
198
210
 
199
211
  ## Copyright
200
212
 
201
- Copyright &copy; 2016-2021. The Stdlib [Authors][stdlib-authors].
213
+ Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
202
214
 
203
215
  </section>
204
216
 
@@ -217,9 +229,23 @@ Copyright &copy; 2016-2021. The Stdlib [Authors][stdlib-authors].
217
229
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/ndarray-base-dtypes2signatures/main.svg
218
230
  [coverage-url]: https://codecov.io/github/stdlib-js/ndarray-base-dtypes2signatures?branch=main
219
231
 
220
- [dependencies-image]: https://img.shields.io/david/stdlib-js/ndarray-base-dtypes2signatures
232
+ <!--
233
+
234
+ [dependencies-image]: https://img.shields.io/david/stdlib-js/ndarray-base-dtypes2signatures.svg
221
235
  [dependencies-url]: https://david-dm.org/stdlib-js/ndarray-base-dtypes2signatures/main
222
236
 
237
+ -->
238
+
239
+ [umd]: https://github.com/umdjs/umd
240
+ [es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
241
+
242
+ [deno-url]: https://github.com/stdlib-js/ndarray-base-dtypes2signatures/tree/deno
243
+ [umd-url]: https://github.com/stdlib-js/ndarray-base-dtypes2signatures/tree/umd
244
+ [esm-url]: https://github.com/stdlib-js/ndarray-base-dtypes2signatures/tree/esm
245
+
246
+ [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
247
+ [chat-url]: https://gitter.im/stdlib-js/stdlib/
248
+
223
249
  [stdlib]: https://github.com/stdlib-js/stdlib
224
250
 
225
251
  [stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
package/docs/repl.txt CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  Parameters
6
6
  ----------
7
- dtypes: Array<string>
7
+ dtypes: ArrayLike
8
8
  List of array argument data types.
9
9
 
10
10
  nin: integer
@@ -28,7 +28,7 @@ import { ArrayLike } from '@stdlib/types/array';
28
28
  * @param dtypes - list of array argument data types
29
29
  * @param nin - number of input array arguments
30
30
  * @param nout - number of output array arguments
31
- * @throws first argument must be an array-like object containing strings
31
+ * @throws first argument must be an array-like object
32
32
  * @throws second argument must be a nonnegative integer
33
33
  * @throws third argument must be a nonnegative integer
34
34
  * @throws first argument must have at least one element
@@ -44,7 +44,7 @@ import { ArrayLike } from '@stdlib/types/array';
44
44
  * var sigs = dtypes2signatures( dtypes, 1, 1 );
45
45
  * // returns [ '(float64) => (float64)', '(float32) => (float32)' ]
46
46
  */
47
- declare function dtypes2signatures( dtypes: ArrayLike<string>, nin: number, nout: number ): ArrayLike<string>; // tslint:disable-line:max-line-length
47
+ declare function dtypes2signatures( dtypes: ArrayLike<any>, nin: number, nout: number ): ArrayLike<string>; // tslint:disable-line:max-line-length
48
48
 
49
49
 
50
50
  // EXPORTS //
@@ -26,7 +26,7 @@ import dtypes2signatures = require( './index' );
26
26
  dtypes2signatures( [ 'float64', 'float64' ], 1, 1 ); // $ExpectType ArrayLike<string>
27
27
  }
28
28
 
29
- // The compiler throws an error if the function is provided a first argument which is not an array-like object containing strings...
29
+ // The compiler throws an error if the function is provided a first argument which is not an array-like object...
30
30
  {
31
31
  dtypes2signatures( 5, 1, 1 ); // $ExpectError
32
32
  dtypes2signatures( true, 1, 1 ); // $ExpectError
@@ -34,7 +34,6 @@ import dtypes2signatures = require( './index' );
34
34
  dtypes2signatures( null, 1, 1 ); // $ExpectError
35
35
  dtypes2signatures( undefined, 1, 1 ); // $ExpectError
36
36
  dtypes2signatures( {}, 1, 1 ); // $ExpectError
37
- dtypes2signatures( ( x: number ): number => x, 1, 1 ); // $ExpectError
38
37
  }
39
38
 
40
39
  // The compiler throws an error if the function is provided a second argument which is not a number...
package/lib/main.js CHANGED
@@ -21,8 +21,8 @@
21
21
  // MODULES //
22
22
 
23
23
  var isArrayLikeObject = require( '@stdlib/assert-is-array-like-object' );
24
- var isString = require( '@stdlib/assert-is-string' ).isPrimitive;
25
24
  var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;
25
+ var resolve = require( '@stdlib/ndarray-base-dtype-resolve-str' );
26
26
 
27
27
 
28
28
  // MAIN //
@@ -30,10 +30,10 @@ var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).is
30
30
  /**
31
31
  * Transforms a list of array argument data types into a list of signatures.
32
32
  *
33
- * @param {StringArray} dtypes - list of array argument data types
33
+ * @param {ArrayLikeObject} dtypes - list of array argument data types
34
34
  * @param {NonNegativeInteger} nin - number of input array arguments
35
35
  * @param {NonNegativeInteger} nout - number of output array arguments
36
- * @throws {TypeError} first argument must be an array-like object containing strings
36
+ * @throws {TypeError} first argument must be an array-like object
37
37
  * @throws {TypeError} second argument must be a nonnegative integer
38
38
  * @throws {TypeError} third argument must be a nonnegative integer
39
39
  * @throws {RangeError} first argument must have at least one element
@@ -53,13 +53,14 @@ function dtypes2signatures( dtypes, nin, nout ) {
53
53
  var len;
54
54
  var out;
55
55
  var tmp;
56
+ var dt;
56
57
  var N;
57
58
  var M;
58
59
  var i;
59
60
  var m;
60
61
 
61
62
  if ( !isArrayLikeObject( dtypes ) ) {
62
- throw new TypeError( 'invalid argument. First argument must be an array-like object containing strings. Value: `' + dtypes + '`.' );
63
+ throw new TypeError( 'invalid argument. First argument must be an array-like object. Value: `' + dtypes + '`.' );
63
64
  }
64
65
  if ( !isNonNegativeInteger( nin ) ) {
65
66
  throw new TypeError( 'invalid argument. Second argument must be a nonnegative integer. Value: `' + nin + '`.' );
@@ -105,11 +106,12 @@ function dtypes2signatures( dtypes, nin, nout ) {
105
106
  }
106
107
  }
107
108
  for ( i = 0; i < len; i++ ) {
108
- if ( !isString( dtypes[ i ] ) ) {
109
- throw new TypeError( 'invalid argument. First argument must be an array-like object containing strings. Value: `' + dtypes + '`.' );
109
+ dt = resolve( dtypes[ i ] );
110
+ if ( dt === null ) {
111
+ dt = dtypes[ i ];
110
112
  }
111
113
  m = i % N;
112
- tmp[ (2*m)+1 ] = dtypes[ i ];
114
+ tmp[ (2*m)+1 ] = dt;
113
115
  if ( m === N-1 ) {
114
116
  out.push( tmp.join( '' ) );
115
117
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/ndarray-base-dtypes2signatures",
3
- "version": "0.0.3",
3
+ "version": "0.0.7",
4
4
  "description": "Transform a list of array argument data types into a list of signatures.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -28,7 +28,7 @@
28
28
  "examples": "make examples",
29
29
  "benchmark": "make benchmark"
30
30
  },
31
- "homepage": "https://github.com/stdlib-js/stdlib",
31
+ "homepage": "https://stdlib.io",
32
32
  "repository": {
33
33
  "type": "git",
34
34
  "url": "git://github.com/stdlib-js/ndarray-base-dtypes2signatures.git"
@@ -39,7 +39,7 @@
39
39
  "dependencies": {
40
40
  "@stdlib/assert-is-array-like-object": "^0.0.x",
41
41
  "@stdlib/assert-is-nonnegative-integer": "^0.0.x",
42
- "@stdlib/assert-is-string": "^0.0.x",
42
+ "@stdlib/ndarray-base-dtype-resolve-str": "^0.0.x",
43
43
  "@stdlib/types": "^0.0.x"
44
44
  },
45
45
  "devDependencies": {
package/CHANGELOG.md DELETED
@@ -1,5 +0,0 @@
1
- # CHANGELOG
2
-
3
- > Package changelog.
4
-
5
- See [GitHub Releases](https://github.com/stdlib-js/ndarray-base-dtypes2signatures/releases) for the changelog.