@stdlib/ndarray-base-dtypes2signatures 0.2.1 → 0.2.3
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 +1 -1
- package/README.md +5 -5
- package/dist/index.js +18 -4
- package/dist/index.js.map +1 -1
- package/lib/index.js +1 -1
- package/package.json +6 -6
package/NOTICE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Copyright (c) 2016-
|
|
1
|
+
Copyright (c) 2016-2026 The Stdlib Authors.
|
package/README.md
CHANGED
|
@@ -221,7 +221,7 @@ See [LICENSE][stdlib-license].
|
|
|
221
221
|
|
|
222
222
|
## Copyright
|
|
223
223
|
|
|
224
|
-
Copyright © 2016-
|
|
224
|
+
Copyright © 2016-2026. The Stdlib [Authors][stdlib-authors].
|
|
225
225
|
|
|
226
226
|
</section>
|
|
227
227
|
|
|
@@ -234,8 +234,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
234
234
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/ndarray-base-dtypes2signatures.svg
|
|
235
235
|
[npm-url]: https://npmjs.org/package/@stdlib/ndarray-base-dtypes2signatures
|
|
236
236
|
|
|
237
|
-
[test-image]: https://github.com/stdlib-js/ndarray-base-dtypes2signatures/actions/workflows/test.yml/badge.svg?branch=v0.2.
|
|
238
|
-
[test-url]: https://github.com/stdlib-js/ndarray-base-dtypes2signatures/actions/workflows/test.yml?query=branch:v0.2.
|
|
237
|
+
[test-image]: https://github.com/stdlib-js/ndarray-base-dtypes2signatures/actions/workflows/test.yml/badge.svg?branch=v0.2.3
|
|
238
|
+
[test-url]: https://github.com/stdlib-js/ndarray-base-dtypes2signatures/actions/workflows/test.yml?query=branch:v0.2.3
|
|
239
239
|
|
|
240
240
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/ndarray-base-dtypes2signatures/main.svg
|
|
241
241
|
[coverage-url]: https://codecov.io/github/stdlib-js/ndarray-base-dtypes2signatures?branch=main
|
|
@@ -247,8 +247,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
247
247
|
|
|
248
248
|
-->
|
|
249
249
|
|
|
250
|
-
[chat-image]: https://img.shields.io/
|
|
251
|
-
[chat-url]: https://
|
|
250
|
+
[chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
|
|
251
|
+
[chat-url]: https://stdlib.zulipchat.com
|
|
252
252
|
|
|
253
253
|
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
254
254
|
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
|
-
"use strict";var p=function(a,i){return function(){return i||a((i={exports:{}}).exports,i),i.exports}};var f=p(function(E,h){
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";var p=function(a,i){return function(){return i||a((i={exports:{}}).exports,i),i.exports}};var f=p(function(E,h){"use strict";var w=require("@stdlib/assert-is-array-like-object"),m=require("@stdlib/assert-is-nonnegative-integer").isPrimitive,c=require("@stdlib/ndarray-base-dtype-resolve-str"),g=require("@stdlib/string-format");function d(a,i,o){var s,l,r,u,n,v,e,t;if(!w(a))throw new TypeError(g("invalid argument. First argument must be an array-like object. Value: `%s`.",a));if(!m(i))throw new TypeError(g("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",i));if(!m(o))throw new TypeError(g("invalid argument. Third argument must be a nonnegative integer. Value: `%s`.",o));if(s=a.length,s===0)throw new RangeError("invalid argument. First argument must contain at least one element.");if(n=i+o,s%n!==0)throw new RangeError("invalid arguments. Length of the first argument is incompatible with the second and third arguments.");for(l=[],r=[],v=2*n,t=2*i,e=0;e<=v;e++)e===0?e===t?r.push("() => ("):r.push("("):e===v?e===t?r.push(") => ()"):r.push(")"):e===t?r.push(") => ("):e%2===1?r.push(""):r.push(", ");for(e=0;e<s;e++)u=c(a[e]),u===null&&(u=a[e]),t=e%n,r[2*t+1]=u,t===n-1&&l.push(r.join(""));return l}h.exports=d});var b=f();module.exports=b;
|
|
2
|
+
/**
|
|
3
|
+
* @license Apache-2.0
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2020 The Stdlib Authors.
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
5
19
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../lib/main.js", "../lib/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 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 isArrayLikeObject = require( '@stdlib/assert-is-array-like-object' );\nvar isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;\nvar resolve = require( '@stdlib/ndarray-base-dtype-resolve-str' );\nvar format = require( '@stdlib/string-format' );\n\n\n// MAIN //\n\n/**\n* Transforms a list of array argument data types into a list of signatures.\n*\n* @param {ArrayLikeObject} dtypes - list of array argument data types\n* @param {NonNegativeInteger} nin - number of input array arguments\n* @param {NonNegativeInteger} nout - number of output array arguments\n* @throws {TypeError} first argument must be an array-like object\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {TypeError} third argument must be a nonnegative integer\n* @throws {RangeError} first argument must contain at least one element\n* @throws {RangeError} length of the first argument is incompatible with the second and third arguments\n* @returns {StringArray} list of signatures\n*\n* @example\n* var dtypes = [\n* 'float64', 'float64',\n* 'float32', 'float32'\n* ];\n*\n* var sigs = dtypes2signatures( dtypes, 1, 1 );\n* // returns [ '(float64) => (float64)', '(float32) => (float32)' ]\n*/\nfunction dtypes2signatures( dtypes, nin, nout ) {\n\tvar len;\n\tvar out;\n\tvar tmp;\n\tvar dt;\n\tvar N;\n\tvar M;\n\tvar i;\n\tvar m;\n\n\tif ( !isArrayLikeObject( dtypes ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an array-like object. Value: `%s`.', dtypes ) );\n\t}\n\tif ( !isNonNegativeInteger( nin ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', nin ) );\n\t}\n\tif ( !isNonNegativeInteger( nout ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a nonnegative integer. Value: `%s`.', nout ) );\n\t}\n\tlen = dtypes.length;\n\tif ( len === 0 ) {\n\t\tthrow new RangeError( 'invalid argument. First argument must contain at least one element.' );\n\t}\n\tN = nin + nout;\n\tif ( len%N !== 0 ) {\n\t\tthrow new RangeError( 'invalid arguments. Length of the first argument is incompatible with the second and third arguments.' );\n\t}\n\tout = [];\n\n\t// Create a temporary array for storing signatures...\n\ttmp = [];\n\n\t// [ '(', <in_dtype>, ', ', ..., ') => (', <out_dtype>, ', ', ..., ')' ] => 1+nin+nin-1+1+nout+nout-1+1 => 1 + (2*nin) + (2*nout) => 1 + (2*(nin+nout))\n\tM = 2 * N;\n\tm = 2 * nin;\n\tfor ( i = 0; i <= M; i++ ) {\n\t\tif ( i === 0 ) {\n\t\t\tif ( i === m ) {\n\t\t\t\ttmp.push( '() => (' );\n\t\t\t} else {\n\t\t\t\ttmp.push( '(' );\n\t\t\t}\n\t\t} else if ( i === M ) {\n\t\t\tif ( i === m ) {\n\t\t\t\ttmp.push( ') => ()' );\n\t\t\t} else {\n\t\t\t\ttmp.push( ')' );\n\t\t\t}\n\t\t} else if ( i === m ) {\n\t\t\ttmp.push( ') => (' );\n\t\t} else if ( i%2 === 1 ) {\n\t\t\ttmp.push( '' );\n\t\t} else {\n\t\t\ttmp.push( ', ' );\n\t\t}\n\t}\n\tfor ( i = 0; i < len; i++ ) {\n\t\tdt = resolve( dtypes[ i ] );\n\t\tif ( dt === null ) {\n\t\t\tdt = dtypes[ i ];\n\t\t}\n\t\tm = i % N;\n\t\ttmp[ (2*m)+1 ] = dt;\n\t\tif ( m === N-1 ) {\n\t\t\tout.push( tmp.join( '' ) );\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = dtypes2signatures;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 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* Transform a list of array argument data types into a list of signatures.\n*\n* @module @stdlib/ndarray-base-dtypes2signatures\n*\n* @example\n* var dtypes2signatures = require( '@stdlib/ndarray-base-dtypes2signatures' );\n*\n* var dtypes = [\n* 'float64', 'float64',\n* 'float32', 'float32'\n* ];\n*\n* var sigs = dtypes2signatures( dtypes,
|
|
4
|
+
"sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 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 isArrayLikeObject = require( '@stdlib/assert-is-array-like-object' );\nvar isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;\nvar resolve = require( '@stdlib/ndarray-base-dtype-resolve-str' );\nvar format = require( '@stdlib/string-format' );\n\n\n// MAIN //\n\n/**\n* Transforms a list of array argument data types into a list of signatures.\n*\n* @param {ArrayLikeObject} dtypes - list of array argument data types\n* @param {NonNegativeInteger} nin - number of input array arguments\n* @param {NonNegativeInteger} nout - number of output array arguments\n* @throws {TypeError} first argument must be an array-like object\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {TypeError} third argument must be a nonnegative integer\n* @throws {RangeError} first argument must contain at least one element\n* @throws {RangeError} length of the first argument is incompatible with the second and third arguments\n* @returns {StringArray} list of signatures\n*\n* @example\n* var dtypes = [\n* 'float64', 'float64',\n* 'float32', 'float32'\n* ];\n*\n* var sigs = dtypes2signatures( dtypes, 1, 1 );\n* // returns [ '(float64) => (float64)', '(float32) => (float32)' ]\n*/\nfunction dtypes2signatures( dtypes, nin, nout ) {\n\tvar len;\n\tvar out;\n\tvar tmp;\n\tvar dt;\n\tvar N;\n\tvar M;\n\tvar i;\n\tvar m;\n\n\tif ( !isArrayLikeObject( dtypes ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an array-like object. Value: `%s`.', dtypes ) );\n\t}\n\tif ( !isNonNegativeInteger( nin ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', nin ) );\n\t}\n\tif ( !isNonNegativeInteger( nout ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a nonnegative integer. Value: `%s`.', nout ) );\n\t}\n\tlen = dtypes.length;\n\tif ( len === 0 ) {\n\t\tthrow new RangeError( 'invalid argument. First argument must contain at least one element.' );\n\t}\n\tN = nin + nout;\n\tif ( len%N !== 0 ) {\n\t\tthrow new RangeError( 'invalid arguments. Length of the first argument is incompatible with the second and third arguments.' );\n\t}\n\tout = [];\n\n\t// Create a temporary array for storing signatures...\n\ttmp = [];\n\n\t// [ '(', <in_dtype>, ', ', ..., ') => (', <out_dtype>, ', ', ..., ')' ] => 1+nin+nin-1+1+nout+nout-1+1 => 1 + (2*nin) + (2*nout) => 1 + (2*(nin+nout))\n\tM = 2 * N;\n\tm = 2 * nin;\n\tfor ( i = 0; i <= M; i++ ) {\n\t\tif ( i === 0 ) {\n\t\t\tif ( i === m ) {\n\t\t\t\ttmp.push( '() => (' );\n\t\t\t} else {\n\t\t\t\ttmp.push( '(' );\n\t\t\t}\n\t\t} else if ( i === M ) {\n\t\t\tif ( i === m ) {\n\t\t\t\ttmp.push( ') => ()' );\n\t\t\t} else {\n\t\t\t\ttmp.push( ')' );\n\t\t\t}\n\t\t} else if ( i === m ) {\n\t\t\ttmp.push( ') => (' );\n\t\t} else if ( i%2 === 1 ) {\n\t\t\ttmp.push( '' );\n\t\t} else {\n\t\t\ttmp.push( ', ' );\n\t\t}\n\t}\n\tfor ( i = 0; i < len; i++ ) {\n\t\tdt = resolve( dtypes[ i ] );\n\t\tif ( dt === null ) {\n\t\t\tdt = dtypes[ i ];\n\t\t}\n\t\tm = i % N;\n\t\ttmp[ (2*m)+1 ] = dt;\n\t\tif ( m === N-1 ) {\n\t\t\tout.push( tmp.join( '' ) );\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = dtypes2signatures;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 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* Transform a list of array argument data types into a list of signatures.\n*\n* @module @stdlib/ndarray-base-dtypes2signatures\n*\n* @example\n* var dtypes2signatures = require( '@stdlib/ndarray-base-dtypes2signatures' );\n*\n* var dtypes = [\n* 'float64', 'float64',\n* 'float32', 'float32'\n* ];\n*\n* var sigs = dtypes2signatures( dtypes, 1, 1 );\n* // returns [ '(float64) => (float64)', '(float32) => (float32)' ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
|
|
5
5
|
"mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAoB,QAAS,qCAAsC,EACnEC,EAAuB,QAAS,uCAAwC,EAAE,YAC1EC,EAAU,QAAS,wCAAyC,EAC5DC,EAAS,QAAS,uBAAwB,EA2B9C,SAASC,EAAmBC,EAAQC,EAAKC,EAAO,CAC/C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAEJ,GAAK,CAACf,EAAmBK,CAAO,EAC/B,MAAM,IAAI,UAAWF,EAAQ,8EAA+EE,CAAO,CAAE,EAEtH,GAAK,CAACJ,EAAsBK,CAAI,EAC/B,MAAM,IAAI,UAAWH,EAAQ,gFAAiFG,CAAI,CAAE,EAErH,GAAK,CAACL,EAAsBM,CAAK,EAChC,MAAM,IAAI,UAAWJ,EAAQ,+EAAgFI,CAAK,CAAE,EAGrH,GADAC,EAAMH,EAAO,OACRG,IAAQ,EACZ,MAAM,IAAI,WAAY,qEAAsE,EAG7F,GADAI,EAAIN,EAAMC,EACLC,EAAII,IAAM,EACd,MAAM,IAAI,WAAY,sGAAuG,EAU9H,IARAH,EAAM,CAAC,EAGPC,EAAM,CAAC,EAGPG,EAAI,EAAID,EACRG,EAAI,EAAIT,EACFQ,EAAI,EAAGA,GAAKD,EAAGC,IACfA,IAAM,EACLA,IAAMC,EACVL,EAAI,KAAM,SAAU,EAEpBA,EAAI,KAAM,GAAI,EAEJI,IAAMD,EACZC,IAAMC,EACVL,EAAI,KAAM,SAAU,EAEpBA,EAAI,KAAM,GAAI,EAEJI,IAAMC,EACjBL,EAAI,KAAM,QAAS,EACRI,EAAE,IAAM,EACnBJ,EAAI,KAAM,EAAG,EAEbA,EAAI,KAAM,IAAK,EAGjB,IAAMI,EAAI,EAAGA,EAAIN,EAAKM,IACrBH,EAAKT,EAASG,EAAQS,CAAE,CAAE,EACrBH,IAAO,OACXA,EAAKN,EAAQS,CAAE,GAEhBC,EAAID,EAAIF,EACRF,EAAM,EAAEK,EAAG,CAAE,EAAIJ,EACZI,IAAMH,EAAE,GACZH,EAAI,KAAMC,EAAI,KAAM,EAAG,CAAE,EAG3B,OAAOD,CACR,CAKAV,EAAO,QAAUK,ICtFjB,IAAIY,EAAO,IAKX,OAAO,QAAUA",
|
|
6
6
|
"names": ["require_main", "__commonJSMin", "exports", "module", "isArrayLikeObject", "isNonNegativeInteger", "resolve", "format", "dtypes2signatures", "dtypes", "nin", "nout", "len", "out", "tmp", "dt", "N", "M", "i", "m", "main"]
|
|
7
7
|
}
|
package/lib/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/ndarray-base-dtypes2signatures",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
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": {
|
|
@@ -30,10 +30,11 @@
|
|
|
30
30
|
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@stdlib/assert-is-array-like-object": "^0.2.
|
|
34
|
-
"@stdlib/assert-is-nonnegative-integer": "^0.2.
|
|
35
|
-
"@stdlib/ndarray-base-dtype-resolve-str": "^0.
|
|
36
|
-
"@stdlib/string-format": "^0.2.
|
|
33
|
+
"@stdlib/assert-is-array-like-object": "^0.2.3",
|
|
34
|
+
"@stdlib/assert-is-nonnegative-integer": "^0.2.3",
|
|
35
|
+
"@stdlib/ndarray-base-dtype-resolve-str": "^0.3.0",
|
|
36
|
+
"@stdlib/string-format": "^0.2.3",
|
|
37
|
+
"@stdlib/error-tools-fmtprodmsg": "^0.2.3"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {},
|
|
39
40
|
"engines": {
|
|
@@ -71,7 +72,6 @@
|
|
|
71
72
|
"utils",
|
|
72
73
|
"util"
|
|
73
74
|
],
|
|
74
|
-
"__stdlib__": {},
|
|
75
75
|
"funding": {
|
|
76
76
|
"type": "opencollective",
|
|
77
77
|
"url": "https://opencollective.com/stdlib"
|