@stdlib/ndarray-base-assert-is-data-type 0.2.1 → 0.3.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
@@ -65,7 +65,7 @@ var isDataType = require( '@stdlib/ndarray-base-assert-is-data-type' );
65
65
 
66
66
  #### isDataType( value )
67
67
 
68
- Tests if an input `value` is a supported ndarray data type.
68
+ Tests if an input value is a supported ndarray data type.
69
69
 
70
70
  ```javascript
71
71
  var bool = isDataType( 'float32' );
@@ -83,6 +83,10 @@ bool = isDataType( 'int32' );
83
83
 
84
84
  <section class="notes">
85
85
 
86
+ ## Notes
87
+
88
+ - The function returns `true` when provided any supported ndarray [data type][@stdlib/ndarray/dtypes], a [struct][@stdlib/dstructs/struct] constructor describing a fixed-width composite data type, or a [`DataType`][@stdlib/ndarray/dtype-ctor] instance.
89
+
86
90
  </section>
87
91
 
88
92
  <!-- /.notes -->
@@ -184,7 +188,7 @@ See [LICENSE][stdlib-license].
184
188
 
185
189
  ## Copyright
186
190
 
187
- Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
191
+ Copyright &copy; 2016-2026. The Stdlib [Authors][stdlib-authors].
188
192
 
189
193
  </section>
190
194
 
@@ -197,8 +201,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
197
201
  [npm-image]: http://img.shields.io/npm/v/@stdlib/ndarray-base-assert-is-data-type.svg
198
202
  [npm-url]: https://npmjs.org/package/@stdlib/ndarray-base-assert-is-data-type
199
203
 
200
- [test-image]: https://github.com/stdlib-js/ndarray-base-assert-is-data-type/actions/workflows/test.yml/badge.svg?branch=v0.2.1
201
- [test-url]: https://github.com/stdlib-js/ndarray-base-assert-is-data-type/actions/workflows/test.yml?query=branch:v0.2.1
204
+ [test-image]: https://github.com/stdlib-js/ndarray-base-assert-is-data-type/actions/workflows/test.yml/badge.svg?branch=v0.3.0
205
+ [test-url]: https://github.com/stdlib-js/ndarray-base-assert-is-data-type/actions/workflows/test.yml?query=branch:v0.3.0
202
206
 
203
207
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/ndarray-base-assert-is-data-type/main.svg
204
208
  [coverage-url]: https://codecov.io/github/stdlib-js/ndarray-base-assert-is-data-type?branch=main
@@ -210,8 +214,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
210
214
 
211
215
  -->
212
216
 
213
- [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
214
- [chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
217
+ [chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
218
+ [chat-url]: https://stdlib.zulipchat.com
215
219
 
216
220
  [stdlib]: https://github.com/stdlib-js/stdlib
217
221
 
@@ -230,6 +234,12 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
230
234
 
231
235
  [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/ndarray-base-assert-is-data-type/main/LICENSE
232
236
 
237
+ [@stdlib/ndarray/dtypes]: https://www.npmjs.com/package/@stdlib/ndarray-dtypes
238
+
239
+ [@stdlib/ndarray/dtype-ctor]: https://www.npmjs.com/package/@stdlib/ndarray-dtype-ctor
240
+
241
+ [@stdlib/dstructs/struct]: https://www.npmjs.com/package/@stdlib/dstructs-struct
242
+
233
243
  </section>
234
244
 
235
245
  <!-- /.links -->
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- "use strict";var s=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var t=s(function(v,e){
2
- var i=require('@stdlib/array-base-assert-contains/dist').factory,u=require('@stdlib/ndarray-dtypes/dist'),c=i(u());e.exports=c
3
- });var o=t();module.exports=o;
1
+ "use strict";var i=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var a=i(function(y,t){
2
+ var s=require('@stdlib/ndarray-base-assert-is-data-type-string/dist'),u=require('@stdlib/ndarray-base-assert-is-data-type-object/dist'),p=require('@stdlib/ndarray-base-assert-is-struct-data-type/dist');function c(r){return s(r)||u(r)||p(r)}t.exports=c
3
+ });var n=a();module.exports=n;
4
4
  /** @license Apache-2.0 */
5
5
  //# 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) 2018 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 contains = require( '@stdlib/array-base-assert-contains' ).factory;\nvar dtypes = require( '@stdlib/ndarray-dtypes' );\n\n\n// MAIN //\n\n/**\n* Tests whether an input value is a supported ndarray data type.\n*\n* @name isDataType\n* @type {Function}\n* @param {*} v - value to test\n* @returns {boolean} boolean indicating whether an input value is a supported ndarray data type\n*\n* @example\n* var bool = isDataType( 'binary' );\n* // returns true\n*\n* bool = isDataType( 'float32' );\n* // returns true\n*\n* bool = isDataType( 'float64' );\n* // returns true\n*\n* bool = isDataType( 'generic' );\n* // returns true\n*\n* bool = isDataType( 'int16' );\n* // returns true\n*\n* bool = isDataType( 'int32' );\n* // returns true\n*\n* bool = isDataType( 'int8' );\n* // returns true\n*\n* bool = isDataType( 'uint16' );\n* // returns true\n*\n* bool = isDataType( 'uint32' );\n* // returns true\n*\n* bool = isDataType( 'uint8' );\n* // returns true\n*\n* bool = isDataType( 'uint8c' );\n* // returns true\n*\n* bool = isDataType( 'foo' );\n* // returns false\n*/\nvar isDataType = contains( dtypes() );\n\n\n// EXPORTS //\n\nmodule.exports = isDataType;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test whether an input value is a supported ndarray data type.\n*\n* @module @stdlib/ndarray-base-assert-is-data-type\n*\n* @example\n* var isDataType = require( '@stdlib/ndarray-base-assert-is-data-type' );\n*\n* var bool = isDataType( 'binary' );\n* // returns true\n*\n* bool = isDataType( 'float32' );\n* // returns true\n*\n* bool = isDataType( 'float64' );\n* // returns true\n*\n* bool = isDataType( 'generic' );\n* // returns true\n*\n* bool = isDataType( 'int16' );\n* // returns true\n*\n* bool = isDataType( 'int32' );\n* // returns true\n*\n* bool = isDataType( 'int8' );\n* // returns true\n*\n* bool = isDataType( 'uint16' );\n* // returns true\n*\n* bool = isDataType( 'uint32' );\n* // returns true\n*\n* bool = isDataType( 'uint8' );\n* // returns true\n*\n* bool = isDataType( 'uint8c' );\n* // returns true\n*\n* bool = isDataType( 'foo' );\n* // returns false\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,EAAW,QAAS,oCAAqC,EAAE,QAC3DC,EAAS,QAAS,wBAAyB,EAkD3CC,EAAaF,EAAUC,EAAO,CAAE,EAKpCF,EAAO,QAAUG,ICXjB,IAAIC,EAAO,IAKX,OAAO,QAAUA",
6
- "names": ["require_main", "__commonJSMin", "exports", "module", "contains", "dtypes", "isDataType", "main"]
4
+ "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isDataTypeString = require( '@stdlib/ndarray-base-assert-is-data-type-string' );\nvar isDataTypeObject = require( '@stdlib/ndarray-base-assert-is-data-type-object' );\nvar isStructDataType = require( '@stdlib/ndarray-base-assert-is-struct-data-type' );\n\n\n// MAIN //\n\n/**\n* Tests whether an input value is a supported ndarray data type.\n*\n* @param {*} v - value to test\n* @returns {boolean} boolean indicating whether an input value is a supported ndarray data type\n*\n* @example\n* var bool = isDataType( 'binary' );\n* // returns true\n*\n* bool = isDataType( 'float32' );\n* // returns true\n*\n* bool = isDataType( 'float64' );\n* // returns true\n*\n* bool = isDataType( 'generic' );\n* // returns true\n*\n* bool = isDataType( 'int16' );\n* // returns true\n*\n* bool = isDataType( 'int32' );\n* // returns true\n*\n* bool = isDataType( 'int8' );\n* // returns true\n*\n* bool = isDataType( 'uint16' );\n* // returns true\n*\n* bool = isDataType( 'uint32' );\n* // returns true\n*\n* bool = isDataType( 'uint8' );\n* // returns true\n*\n* bool = isDataType( 'uint8c' );\n* // returns true\n*\n* bool = isDataType( 'foo' );\n* // returns false\n*/\nfunction isDataType( v ) {\n\treturn (\n\t\tisDataTypeString( v ) ||\n\t\tisDataTypeObject( v ) ||\n\t\tisStructDataType( v )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isDataType;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test whether an input value is a supported ndarray data type.\n*\n* @module @stdlib/ndarray-base-assert-is-data-type\n*\n* @example\n* var isDataType = require( '@stdlib/ndarray-base-assert-is-data-type' );\n*\n* var bool = isDataType( 'binary' );\n* // returns true\n*\n* bool = isDataType( 'float32' );\n* // returns true\n*\n* bool = isDataType( 'float64' );\n* // returns true\n*\n* bool = isDataType( 'generic' );\n* // returns true\n*\n* bool = isDataType( 'int16' );\n* // returns true\n*\n* bool = isDataType( 'int32' );\n* // returns true\n*\n* bool = isDataType( 'int8' );\n* // returns true\n*\n* bool = isDataType( 'uint16' );\n* // returns true\n*\n* bool = isDataType( 'uint32' );\n* // returns true\n*\n* bool = isDataType( 'uint8' );\n* // returns true\n*\n* bool = isDataType( 'uint8c' );\n* // returns true\n*\n* bool = isDataType( 'foo' );\n* // returns false\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,EAAmB,QAAS,iDAAkD,EAC9EC,EAAmB,QAAS,iDAAkD,EAC9EC,EAAmB,QAAS,iDAAkD,EAgDlF,SAASC,EAAYC,EAAI,CACxB,OACCJ,EAAkBI,CAAE,GACpBH,EAAkBG,CAAE,GACpBF,EAAkBE,CAAE,CAEtB,CAKAL,EAAO,QAAUI,IChBjB,IAAIE,EAAO,IAKX,OAAO,QAAUA",
6
+ "names": ["require_main", "__commonJSMin", "exports", "module", "isDataTypeString", "isDataTypeObject", "isStructDataType", "isDataType", "v", "main"]
7
7
  }
package/lib/main.js CHANGED
@@ -20,8 +20,9 @@
20
20
 
21
21
  // MODULES //
22
22
 
23
- var contains = require( '@stdlib/array-base-assert-contains' ).factory;
24
- var dtypes = require( '@stdlib/ndarray-dtypes' );
23
+ var isDataTypeString = require( '@stdlib/ndarray-base-assert-is-data-type-string' );
24
+ var isDataTypeObject = require( '@stdlib/ndarray-base-assert-is-data-type-object' );
25
+ var isStructDataType = require( '@stdlib/ndarray-base-assert-is-struct-data-type' );
25
26
 
26
27
 
27
28
  // MAIN //
@@ -29,8 +30,6 @@ var dtypes = require( '@stdlib/ndarray-dtypes' );
29
30
  /**
30
31
  * Tests whether an input value is a supported ndarray data type.
31
32
  *
32
- * @name isDataType
33
- * @type {Function}
34
33
  * @param {*} v - value to test
35
34
  * @returns {boolean} boolean indicating whether an input value is a supported ndarray data type
36
35
  *
@@ -71,7 +70,13 @@ var dtypes = require( '@stdlib/ndarray-dtypes' );
71
70
  * bool = isDataType( 'foo' );
72
71
  * // returns false
73
72
  */
74
- var isDataType = contains( dtypes() );
73
+ function isDataType( v ) {
74
+ return (
75
+ isDataTypeString( v ) ||
76
+ isDataTypeObject( v ) ||
77
+ isStructDataType( v )
78
+ );
79
+ }
75
80
 
76
81
 
77
82
  // EXPORTS //
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/ndarray-base-assert-is-data-type",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Test if an input value is a supported ndarray data type.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -30,8 +30,9 @@
30
30
  "url": "https://github.com/stdlib-js/stdlib/issues"
31
31
  },
32
32
  "dependencies": {
33
- "@stdlib/array-base-assert-contains": "^0.2.1",
34
- "@stdlib/ndarray-dtypes": "^0.2.1"
33
+ "@stdlib/ndarray-base-assert-is-data-type-object": "github:stdlib-js/ndarray-base-assert-is-data-type-object#main",
34
+ "@stdlib/ndarray-base-assert-is-data-type-string": "github:stdlib-js/ndarray-base-assert-is-data-type-string#main",
35
+ "@stdlib/ndarray-base-assert-is-struct-data-type": "github:stdlib-js/ndarray-base-assert-is-struct-data-type#main"
35
36
  },
36
37
  "devDependencies": {},
37
38
  "engines": {
@@ -72,7 +73,6 @@
72
73
  "validation",
73
74
  "isvalid"
74
75
  ],
75
- "__stdlib__": {},
76
76
  "funding": {
77
77
  "type": "opencollective",
78
78
  "url": "https://opencollective.com/stdlib"