@stdlib/strided-base-unary-dtype-signatures 0.0.1 → 0.2.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-2023 The Stdlib Authors.
1
+ Copyright (c) 2016-2024 The Stdlib Authors.
package/README.md CHANGED
@@ -18,6 +18,17 @@ limitations under the License.
18
18
 
19
19
  -->
20
20
 
21
+
22
+ <details>
23
+ <summary>
24
+ About stdlib...
25
+ </summary>
26
+ <p>We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.</p>
27
+ <p>The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.</p>
28
+ <p>When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.</p>
29
+ <p>To join us in bringing numerical computing to the web, get started by checking us out on <a href="https://github.com/stdlib-js/stdlib">GitHub</a>, and please consider <a href="https://opencollective.com/stdlib">financially supporting stdlib</a>. We greatly appreciate your continued support!</p>
30
+ </details>
31
+
21
32
  # Unary Signatures
22
33
 
23
34
  [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
@@ -153,6 +164,12 @@ console.log( str );
153
164
 
154
165
  <section class="related">
155
166
 
167
+ * * *
168
+
169
+ ## See Also
170
+
171
+ - <span class="package-name">[`@stdlib/strided-base/unary-signature-callbacks`][@stdlib/strided/base/unary-signature-callbacks]</span><span class="delimiter">: </span><span class="description">assign callbacks to unary interfaces according to type promotion rules.</span>
172
+
156
173
  </section>
157
174
 
158
175
  <!-- /.related -->
@@ -183,7 +200,7 @@ See [LICENSE][stdlib-license].
183
200
 
184
201
  ## Copyright
185
202
 
186
- Copyright &copy; 2016-2023. The Stdlib [Authors][stdlib-authors].
203
+ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
187
204
 
188
205
  </section>
189
206
 
@@ -196,8 +213,8 @@ Copyright &copy; 2016-2023. The Stdlib [Authors][stdlib-authors].
196
213
  [npm-image]: http://img.shields.io/npm/v/@stdlib/strided-base-unary-dtype-signatures.svg
197
214
  [npm-url]: https://npmjs.org/package/@stdlib/strided-base-unary-dtype-signatures
198
215
 
199
- [test-image]: https://github.com/stdlib-js/strided-base-unary-dtype-signatures/actions/workflows/test.yml/badge.svg?branch=v0.0.1
200
- [test-url]: https://github.com/stdlib-js/strided-base-unary-dtype-signatures/actions/workflows/test.yml?query=branch:v0.0.1
216
+ [test-image]: https://github.com/stdlib-js/strided-base-unary-dtype-signatures/actions/workflows/test.yml/badge.svg?branch=v0.2.0
217
+ [test-url]: https://github.com/stdlib-js/strided-base-unary-dtype-signatures/actions/workflows/test.yml?query=branch:v0.2.0
201
218
 
202
219
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/strided-base-unary-dtype-signatures/main.svg
203
220
  [coverage-url]: https://codecov.io/github/stdlib-js/strided-base-unary-dtype-signatures?branch=main
@@ -210,7 +227,7 @@ Copyright &copy; 2016-2023. The Stdlib [Authors][stdlib-authors].
210
227
  -->
211
228
 
212
229
  [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
213
- [chat-url]: https://gitter.im/stdlib-js/stdlib/
230
+ [chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
214
231
 
215
232
  [stdlib]: https://github.com/stdlib-js/stdlib
216
233
 
@@ -220,15 +237,24 @@ Copyright &copy; 2016-2023. The Stdlib [Authors][stdlib-authors].
220
237
  [es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
221
238
 
222
239
  [deno-url]: https://github.com/stdlib-js/strided-base-unary-dtype-signatures/tree/deno
240
+ [deno-readme]: https://github.com/stdlib-js/strided-base-unary-dtype-signatures/blob/deno/README.md
223
241
  [umd-url]: https://github.com/stdlib-js/strided-base-unary-dtype-signatures/tree/umd
242
+ [umd-readme]: https://github.com/stdlib-js/strided-base-unary-dtype-signatures/blob/umd/README.md
224
243
  [esm-url]: https://github.com/stdlib-js/strided-base-unary-dtype-signatures/tree/esm
244
+ [esm-readme]: https://github.com/stdlib-js/strided-base-unary-dtype-signatures/blob/esm/README.md
225
245
  [branches-url]: https://github.com/stdlib-js/strided-base-unary-dtype-signatures/blob/main/branches.md
226
246
 
227
247
  [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/strided-base-unary-dtype-signatures/main/LICENSE
228
248
 
229
- [@stdlib/strided/dtypes]: https://www.npmjs.com/package/@stdlib/stdlib
249
+ [@stdlib/strided/dtypes]: https://www.npmjs.com/package/@stdlib/strided-dtypes
250
+
251
+ [@stdlib/ndarray/promotion-rules]: https://www.npmjs.com/package/@stdlib/ndarray-promotion-rules
252
+
253
+ <!-- <related-links> -->
254
+
255
+ [@stdlib/strided/base/unary-signature-callbacks]: https://www.npmjs.com/package/@stdlib/strided-base-unary-signature-callbacks
230
256
 
231
- [@stdlib/ndarray/promotion-rules]: https://www.npmjs.com/package/@stdlib/stdlib
257
+ <!-- </related-links> -->
232
258
 
233
259
  </section>
234
260
 
package/SECURITY.md ADDED
@@ -0,0 +1,5 @@
1
+ # Security
2
+
3
+ > Policy for reporting security vulnerabilities.
4
+
5
+ See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security).
@@ -0,0 +1,3 @@
1
+ /// <reference path="../docs/types/index.d.ts" />
2
+ import signatures from '../docs/types/index';
3
+ export = signatures;
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";var m=function(a,e){return function(){return e||a((e={exports:{}}).exports,e),e.exports}};var p=m(function(x,c){
2
+ var q=require('@stdlib/ndarray-safe-casts/dist'),d=require('@stdlib/strided-base-dtype-resolve-enum/dist'),E=require('@stdlib/strided-base-dtype-resolve-str/dist'),b=require('@stdlib/error-tools-fmtprodmsg/dist');function k(a,e){var i,r,u,s,n,t,o;for(r=a.length,u=e.length,i=[],o=0,n=0;n<r&&!(o>=u);n++)for(s=a[n],t=o;t<u;t++)if(s===e[t]){o=t+1,i.push(s);break}return i}function g(a){var e,i,r;for(e=[],r=0;r<a.length;r++){if(i=E(a[r]),i===null)return new TypeError(b('1fVDj',a[r]));e.push(i)}return e}function w(a,e,i){var r,u,s,n,t,o,l,h,v,f;if(arguments.length>2?u=i:u={},t=g(a),t instanceof Error)throw t;if(e===a)o=t;else if(o=g(e),o instanceof Error)throw o;for(o.sort(),h=t.length,n=[],v=0;v<h;v++)if(l=t[v],r=q(l),r!==null)for(r=k(o,r.sort()),f=0;f<r.length;f++)n.push(l,r[f]);if(u.enums){for(s=[],v=0;v<n.length;v++)s.push(d(n[v]));n=s}return n}c.exports=w
3
+ });var M=p();module.exports=M;
4
+ /** @license Apache-2.0 */
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../lib/main.js", "../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// MODULES //\n\nvar safeCasts = require( '@stdlib/ndarray-safe-casts' );\nvar resolveEnum = require( '@stdlib/strided-base-dtype-resolve-enum' );\nvar resolveStr = require( '@stdlib/strided-base-dtype-resolve-str' );\nvar format = require( '@stdlib/string-format' );\n\n\n// FUNCTIONS //\n\n/**\n* Returns the intersection of two sorted lists.\n*\n* @private\n* @param {ArrayLikeObject} list1 - first sorted list\n* @param {ArrayLikeObject} list2 - second sorted list\n* @returns {ArrayLikeObject} result\n*\n* @example\n* var list1 = [ 'a', 'b', 'c', 'd' ];\n* var list2 = [ 'b', 'd', 'e' ];\n*\n* var out = intersection( list1, list2 );\n* // returns [ 'b', 'd' ]\n*/\nfunction intersection( list1, list2 ) {\n\tvar out;\n\tvar M;\n\tvar N;\n\tvar v;\n\tvar i;\n\tvar j;\n\tvar k;\n\n\tM = list1.length;\n\tN = list2.length;\n\n\tout = [];\n\tk = 0;\n\tfor ( i = 0; i < M; i++ ) {\n\t\tif ( k >= N ) {\n\t\t\tbreak;\n\t\t}\n\t\tv = list1[ i ];\n\t\tfor ( j = k; j < N; j++ ) {\n\t\t\tif ( v === list2[ j ] ) {\n\t\t\t\tk = j + 1;\n\t\t\t\tout.push( v );\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn out;\n}\n\n/**\n* Resolves a list of data types to data type strings.\n*\n* @private\n* @param {ArrayLikeObject} dtypes - list of data types\n* @returns {(StringArray|Error)} data type strings (or an error)\n*\n* @example\n* var out = resolve( [ 1, 2, 3 ] );\n* // returns [...]\n*/\nfunction resolve( dtypes ) {\n\tvar out;\n\tvar dt;\n\tvar i;\n\n\tout = [];\n\tfor ( i = 0; i < dtypes.length; i++ ) {\n\t\tdt = resolveStr( dtypes[ i ] );\n\t\tif ( dt === null ) {\n\t\t\treturn new TypeError( format( 'invalid argument. Must provide recognized data types. Unable to resolve a data type string. Value: `%s`.', dtypes[ i ] ) );\n\t\t}\n\t\tout.push( dt );\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates a list of unary interface signatures from strided array data types.\n*\n* ## Notes\n*\n* - The function returns a strided array having a stride length of `2` (i.e., every `2` elements define a unary interface signature).\n* - For each signature (i.e., set of two consecutive non-overlapping strided array elements), the first element is the input data type and the second element is the return data type.\n* - All signatures follow type promotion rules.\n*\n* @param {Array} dtypes1 - list of supported data types for the first argument\n* @param {Array} dtypes2 - list of supported data types for the output argument\n* @param {Options} [options] - options\n* @param {boolean} [options.enums=false] - boolean flag indicating whether to return signatures as a list of enumeration constants\n* @throws {TypeError} must provide recognized data types\n* @returns {Array} strided array containing unary interface signatures\n*\n* @example\n* var dtypes = [\n* 'float64',\n* 'float32',\n* 'int32',\n* 'uint8'\n* ];\n*\n* var sigs = signatures( dtypes, dtypes );\n* // e.g., returns [ 'float32', 'float32', ... ]\n*/\nfunction signatures( dtypes1, dtypes2, options ) {\n\tvar casts;\n\tvar opts;\n\tvar tmp;\n\tvar out;\n\tvar dt1;\n\tvar dt2;\n\tvar t1;\n\tvar M;\n\tvar i;\n\tvar j;\n\n\tif ( arguments.length > 2 ) {\n\t\topts = options;\n\t} else {\n\t\topts = {};\n\t}\n\t// Resolve the list of provided data types to data type strings:\n\tdt1 = resolve( dtypes1 );\n\tif ( dt1 instanceof Error ) {\n\t\tthrow dt1;\n\t}\n\tif ( dtypes2 === dtypes1 ) { // don't do work if we don't need to\n\t\tdt2 = dt1;\n\t} else {\n\t\tdt2 = resolve( dtypes2 );\n\t\tif ( dt2 instanceof Error ) {\n\t\t\tthrow dt2;\n\t\t}\n\t}\n\t// Sort the list of return dtypes:\n\tdt2.sort();\n\n\t// Generate the list of signatures...\n\tM = dt1.length;\n\tout = [];\n\tfor ( i = 0; i < M; i++ ) {\n\t\tt1 = dt1[ i ];\n\n\t\t// Resolve the list of safe casts for the input dtype:\n\t\tcasts = safeCasts( t1 );\n\t\tif ( casts === null ) {\n\t\t\tcontinue;\n\t\t}\n\t\t// Remove safe casts which are not among the supported output dtypes:\n\t\tcasts = intersection( dt2, casts.sort() );\n\n\t\t// Generate signatures for allowed casts...\n\t\tfor ( j = 0; j < casts.length; j++ ) {\n\t\t\tout.push( t1, casts[ j ] );\n\t\t}\n\t}\n\tif ( opts.enums ) {\n\t\ttmp = [];\n\t\tfor ( i = 0; i < out.length; i++ ) {\n\t\t\ttmp.push( resolveEnum( out[ i ] ) );\n\t\t}\n\t\tout = tmp;\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = signatures;\n", "/**\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* Generate a list of unary interface signatures from strided array data types.\n*\n* @module @stdlib/strided-base-unary-dtype-signatures\n*\n* @example\n* var signatures = require( '@stdlib/strided-base-unary-dtype-signatures' );\n*\n* var dtypes = [\n* 'float64',\n* 'float32',\n* 'int32',\n* 'uint8'\n* ];\n*\n* var sigs = signatures( dtypes, dtypes );\n* // e.g., returns [ 'float32', 'float32', ... ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
5
+ "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAY,QAAS,4BAA6B,EAClDC,EAAc,QAAS,yCAA0C,EACjEC,EAAa,QAAS,wCAAyC,EAC/DC,EAAS,QAAS,uBAAwB,EAoB9C,SAASC,EAAcC,EAAOC,EAAQ,CACrC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,IALAL,EAAIH,EAAM,OACVI,EAAIH,EAAM,OAEVC,EAAM,CAAC,EACPM,EAAI,EACEF,EAAI,EAAGA,EAAIH,GACX,EAAAK,GAAKJ,GADSE,IAKnB,IADAD,EAAIL,EAAOM,CAAE,EACPC,EAAIC,EAAGD,EAAIH,EAAGG,IACnB,GAAKF,IAAMJ,EAAOM,CAAE,EAAI,CACvBC,EAAID,EAAI,EACRL,EAAI,KAAMG,CAAE,EACZ,KACD,CAGF,OAAOH,CACR,CAaA,SAASO,EAASC,EAAS,CAC1B,IAAIR,EACAS,EACAL,EAGJ,IADAJ,EAAM,CAAC,EACDI,EAAI,EAAGA,EAAII,EAAO,OAAQJ,IAAM,CAErC,GADAK,EAAKd,EAAYa,EAAQJ,CAAE,CAAE,EACxBK,IAAO,KACX,OAAO,IAAI,UAAWb,EAAQ,2GAA4GY,EAAQJ,CAAE,CAAE,CAAE,EAEzJJ,EAAI,KAAMS,CAAG,CACd,CACA,OAAOT,CACR,CAgCA,SAASU,EAAYC,EAASC,EAASC,EAAU,CAChD,IAAIC,EACAC,EACAC,EACAhB,EACAiB,EACAC,EACAC,EACAlB,EACAG,EACAC,EASJ,GAPK,UAAU,OAAS,EACvBU,EAAOF,EAEPE,EAAO,CAAC,EAGTE,EAAMV,EAASI,CAAQ,EAClBM,aAAe,MACnB,MAAMA,EAEP,GAAKL,IAAYD,EAChBO,EAAMD,UAENC,EAAMX,EAASK,CAAQ,EAClBM,aAAe,MACnB,MAAMA,EASR,IALAA,EAAI,KAAK,EAGTjB,EAAIgB,EAAI,OACRjB,EAAM,CAAC,EACDI,EAAI,EAAGA,EAAIH,EAAGG,IAKnB,GAJAe,EAAKF,EAAKb,CAAE,EAGZU,EAAQrB,EAAW0B,CAAG,EACjBL,IAAU,KAOf,IAHAA,EAAQjB,EAAcqB,EAAKJ,EAAM,KAAK,CAAE,EAGlCT,EAAI,EAAGA,EAAIS,EAAM,OAAQT,IAC9BL,EAAI,KAAMmB,EAAIL,EAAOT,CAAE,CAAE,EAG3B,GAAKU,EAAK,MAAQ,CAEjB,IADAC,EAAM,CAAC,EACDZ,EAAI,EAAGA,EAAIJ,EAAI,OAAQI,IAC5BY,EAAI,KAAMtB,EAAaM,EAAKI,CAAE,CAAE,CAAE,EAEnCJ,EAAMgB,CACP,CACA,OAAOhB,CACR,CAKAR,EAAO,QAAUkB,IC5JjB,IAAIU,EAAO,IAKX,OAAO,QAAUA",
6
+ "names": ["require_main", "__commonJSMin", "exports", "module", "safeCasts", "resolveEnum", "resolveStr", "format", "intersection", "list1", "list2", "out", "M", "N", "v", "i", "j", "k", "resolve", "dtypes", "dt", "signatures", "dtypes1", "dtypes2", "options", "casts", "opts", "tmp", "dt1", "dt2", "t1", "main"]
7
+ }
@@ -16,7 +16,7 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- // TypeScript Version: 2.0
19
+ // TypeScript Version: 4.1
20
20
 
21
21
  /// <reference types="@stdlib/types"/>
22
22
 
@@ -59,7 +59,7 @@ interface Options {
59
59
  * var sigs = signatures( dtypes, dtypes );
60
60
  * // e.g., returns [ 'float32', 'float32', ... ]
61
61
  */
62
- declare function signatures( dtypes1: ArrayLike<any>, dtypes2: ArrayLike<any>, options?: Options ): ArrayLike<string | number>; // tslint:disable-line:max-line-length
62
+ declare function signatures( dtypes1: ArrayLike<any>, dtypes2: ArrayLike<any>, options?: Options ): ArrayLike<string | number>;
63
63
 
64
64
 
65
65
  // EXPORTS //
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/strided-base-unary-dtype-signatures",
3
- "version": "0.0.1",
3
+ "version": "0.2.0",
4
4
  "description": "Generate a list of unary interface signatures from strided array data types.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -37,23 +37,25 @@
37
37
  "url": "https://github.com/stdlib-js/stdlib/issues"
38
38
  },
39
39
  "dependencies": {
40
- "@stdlib/ndarray-safe-casts": "^0.0.x",
41
- "@stdlib/strided-base-dtype-resolve-enum": "^0.0.x",
42
- "@stdlib/strided-base-dtype-resolve-str": "^0.0.x",
43
- "@stdlib/string-format": "^0.0.x",
44
- "@stdlib/types": "^0.0.x"
40
+ "@stdlib/ndarray-safe-casts": "^0.2.0",
41
+ "@stdlib/strided-base-dtype-resolve-enum": "^0.2.0",
42
+ "@stdlib/strided-base-dtype-resolve-str": "^0.2.0",
43
+ "@stdlib/string-format": "^0.2.0",
44
+ "@stdlib/types": "^0.3.1",
45
+ "@stdlib/error-tools-fmtprodmsg": "^0.1.1"
45
46
  },
46
47
  "devDependencies": {
47
- "@stdlib/assert-is-array": "^0.0.x",
48
- "@stdlib/assert-is-integer-array": "^0.0.x",
49
- "@stdlib/assert-is-string-array": "^0.0.x",
50
- "@stdlib/bench": "^0.0.x",
51
- "@stdlib/strided-base-dtype-str2enum": "^0.0.x",
52
- "@stdlib/strided-dtypes": "^0.0.x",
53
- "@stdlib/string-replace": "^0.0.x",
48
+ "@stdlib/assert-is-array": "^0.1.1",
49
+ "@stdlib/assert-is-integer-array": "^0.1.0",
50
+ "@stdlib/assert-is-string-array": "^0.1.1",
51
+ "@stdlib/strided-base-dtype-str2enum": "^0.2.0",
52
+ "@stdlib/strided-dtypes": "^0.1.0",
53
+ "@stdlib/string-replace": "^0.1.1",
54
54
  "tape": "git+https://github.com/kgryte/tape.git#fix/globby",
55
55
  "istanbul": "^0.4.1",
56
- "tap-min": "git+https://github.com/Planeshifter/tap-min.git"
56
+ "tap-min": "git+https://github.com/Planeshifter/tap-min.git",
57
+ "@stdlib/bench-harness": "^0.2.0",
58
+ "@stdlib/bench": "^0.3.1"
57
59
  },
58
60
  "engines": {
59
61
  "node": ">=0.10.0",
@@ -90,7 +92,7 @@
90
92
  ],
91
93
  "__stdlib__": {},
92
94
  "funding": {
93
- "type": "patreon",
94
- "url": "https://www.patreon.com/athan"
95
+ "type": "opencollective",
96
+ "url": "https://opencollective.com/stdlib"
95
97
  }
96
98
  }
package/docs/repl.txt DELETED
@@ -1,43 +0,0 @@
1
-
2
- {{alias}}( dtypes1, dtypes2[, options] )
3
- Generates a list of unary interface signatures from strided array data
4
- types.
5
-
6
- The function returns a strided array having a stride length of two (i.e.,
7
- every two elements define a unary interface signature).
8
-
9
- For each signature (i.e., set of two consecutive non-overlapping strided
10
- array elements), the first element is the input data type and the second
11
- element is the return data type.
12
-
13
- All signatures follow type promotion rules.
14
-
15
- Parameters
16
- ----------
17
- dtypes1: ArrayLike<any>
18
- List of supported data types for the input argument.
19
-
20
- dtypes2: ArrayLike<any>
21
- List of supported data types for the output argument.
22
-
23
- options: Object (optional)
24
- Options.
25
-
26
- options.enums: boolean (optional)
27
- Boolean flag indicating whether to return signatures as a list of data
28
- type enumeration constants. Default: false.
29
-
30
- Returns
31
- -------
32
- out: Array
33
- Strided array containing unary interface signatures.
34
-
35
- Examples
36
- --------
37
- > var dt = {{alias:@stdlib/strided/dtypes}}();
38
- > var out = {{alias}}( dt, dt )
39
- [...]
40
-
41
- See Also
42
- --------
43
-
@@ -1,103 +0,0 @@
1
- /*
2
- * @license Apache-2.0
3
- *
4
- * Copyright (c) 2022 The Stdlib Authors.
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- */
18
-
19
- import signatures = require( './index' );
20
-
21
-
22
- // TESTS //
23
-
24
- // The function returns a list of signatures...
25
- {
26
- const dt = [ 'float64', 'float32' ];
27
-
28
- signatures( dt, dt ); // $ExpectType ArrayLike<string | number>
29
- signatures( dt, dt, {} ); // $ExpectType ArrayLike<string | number>
30
- signatures( dt, dt, { 'enums': false } ); // $ExpectType ArrayLike<string | number>
31
- signatures( dt, dt, { 'enums': true } ); // $ExpectType ArrayLike<string | number>
32
- }
33
-
34
- // The compiler throws an error if provided a first argument which is not an array-like object...
35
- {
36
- const dt = [ 'float64', 'float32' ];
37
-
38
- signatures( 10, dt ); // $ExpectError
39
- signatures( true, dt ); // $ExpectError
40
- signatures( false, dt ); // $ExpectError
41
- signatures( null, dt ); // $ExpectError
42
- signatures( undefined, dt ); // $ExpectError
43
- signatures( {}, dt ); // $ExpectError
44
-
45
- signatures( 10, dt, {} ); // $ExpectError
46
- signatures( true, dt, {} ); // $ExpectError
47
- signatures( false, dt, {} ); // $ExpectError
48
- signatures( null, dt, {} ); // $ExpectError
49
- signatures( undefined, dt, {} ); // $ExpectError
50
- signatures( {}, dt, {} ); // $ExpectError
51
- }
52
-
53
- // The compiler throws an error if provided a second argument which is not an array-like object...
54
- {
55
- const dt = [ 'float64', 'float32' ];
56
-
57
- signatures( dt, 10 ); // $ExpectError
58
- signatures( dt, true ); // $ExpectError
59
- signatures( dt, false ); // $ExpectError
60
- signatures( dt, null ); // $ExpectError
61
- signatures( dt, undefined ); // $ExpectError
62
- signatures( dt, {} ); // $ExpectError
63
-
64
- signatures( dt, 10, {} ); // $ExpectError
65
- signatures( dt, true, {} ); // $ExpectError
66
- signatures( dt, false, {} ); // $ExpectError
67
- signatures( dt, null, {} ); // $ExpectError
68
- signatures( dt, undefined, {} ); // $ExpectError
69
- signatures( dt, {}, {} ); // $ExpectError
70
- }
71
-
72
- // The compiler throws an error if provided a third argument which is not an options object...
73
- {
74
- const dt = [ 'float64', 'float32' ];
75
-
76
- signatures( dt, dt, 10 ); // $ExpectError
77
- signatures( dt, dt, '10' ); // $ExpectError
78
- signatures( dt, dt, true ); // $ExpectError
79
- signatures( dt, dt, false ); // $ExpectError
80
- signatures( dt, dt, null ); // $ExpectError
81
- }
82
-
83
- // The compiler throws an error if provided an `enums` option which is not a boolean...
84
- {
85
- const dt = [ 'float64', 'float32' ];
86
-
87
- signatures( dt, dt, { 'enums': 10 } ); // $ExpectError
88
- signatures( dt, dt, { 'enums': '10' } ); // $ExpectError
89
- signatures( dt, dt, { 'enums': null } ); // $ExpectError
90
- signatures( dt, dt, { 'enums': {} } ); // $ExpectError
91
- signatures( dt, dt, { 'enums': [] } ); // $ExpectError
92
- signatures( dt, dt, { 'enums': ( x: number ): number => x } ); // $ExpectError
93
- }
94
-
95
- // The compiler throws an error if the function is provided an unsupported number of arguments...
96
- {
97
- const dt = [ 'float64', 'float32' ];
98
-
99
- signatures(); // $ExpectError
100
- signatures( dt ); // $ExpectError
101
- signatures( dt, dt, dt, dt ); // $ExpectError
102
- signatures( dt, dt, {}, {} ); // $ExpectError
103
- }