@stdlib/array-dtypes
Advanced tools
+4
-3
@@ -1,5 +0,6 @@ | ||
| "use strict";var e=function(i,t){return function(){return t||i((t={exports:{}}).exports,t),t.exports}};var l=e(function(m,c){c.exports={all:["complex64","complex128","float32","float64","generic","int16","int32","int8","uint16","uint32","uint8","uint8c"],typed:["complex64","complex128","float32","float64","int16","int32","int8","uint16","uint32","uint8","uint8c"],floating_point:["complex64","complex128","float32","float64"],real_floating_point:["float32","float64"],complex_floating_point:["complex64","complex128"],integer:["int16","int32","int8","uint16","uint32","uint8","uint8c"],signed_integer:["int16","int32","int8"],unsigned_integer:["uint16","uint32","uint8","uint8c"],real:["float32","float64","int16","int32","int8","uint16","uint32","uint8","uint8c"],numeric:["complex64","complex128","float32","float64","int16","int32","int8","uint16","uint32","uint8","uint8c"]}});var o=e(function(x,a){ | ||
| var f=require('@stdlib/string-base-replace/dist'),u=l(),r=/_and_generic$/;function p(){var i,t,n;return arguments.length===0?u.all.slice():(n=!1,i=arguments[0],r.test(i)&&(i=f(i,r,""),i!=="all"&&(n=!0)),t=u[i],t=t?t.slice():[],n&&t.length>0&&t.push("generic"),t)}a.exports=p | ||
| });var s=o();module.exports=s; | ||
| "use strict";var e=function(i,t){return function(){return t||i((t={exports:{}}).exports,t),t.exports}};var l=e(function(m,c){c.exports={all:["bool","complex64","complex128","float32","float64","generic","int16","int32","int8","uint16","uint32","uint8","uint8c"],typed:["bool","complex64","complex128","float32","float64","int16","int32","int8","uint16","uint32","uint8","uint8c"],floating_point:["complex64","complex128","float32","float64"],real_floating_point:["float32","float64"],complex_floating_point:["complex64","complex128"],boolean:["bool"],integer:["int16","int32","int8","uint16","uint32","uint8","uint8c"],signed_integer:["int16","int32","int8"],unsigned_integer:["uint16","uint32","uint8","uint8c"],real:["float32","float64","int16","int32","int8","uint16","uint32","uint8","uint8c"],numeric:["complex64","complex128","float32","float64","int16","int32","int8","uint16","uint32","uint8","uint8c"]}});var r=e(function(x,a){ | ||
| var f=require('@stdlib/string-base-replace/dist'),o=l(),u=/_and_generic$/;function p(){var i,t,n;return arguments.length===0?o.all.slice():(n=!1,i=arguments[0],u.test(i)&&(i=f(i,u,""),i!=="all"&&(n=!0)),t=o[i],t=t?t.slice():[],n&&t.length>0&&t.push("generic"),t)}a.exports=p | ||
| });var s=r();module.exports=s; | ||
| /** @license Apache-2.0 */ | ||
| /** @license Apache-2.0 */ | ||
| //# sourceMappingURL=index.js.map |
| { | ||
| "version": 3, | ||
| "sources": ["../lib/dtypes.json", "../lib/main.js", "../lib/index.js"], | ||
| "sourcesContent": ["{\n \"all\": [\n \"complex64\",\n \"complex128\",\n \"float32\",\n \"float64\",\n \"generic\",\n \"int16\",\n \"int32\",\n \"int8\",\n \"uint16\",\n \"uint32\",\n \"uint8\",\n \"uint8c\"\n ],\n \"typed\": [\n \"complex64\",\n \"complex128\",\n \"float32\",\n \"float64\",\n \"int16\",\n \"int32\",\n \"int8\",\n \"uint16\",\n \"uint32\",\n \"uint8\",\n \"uint8c\"\n ],\n \"floating_point\": [\n \"complex64\",\n \"complex128\",\n \"float32\",\n \"float64\"\n ],\n \"real_floating_point\": [\n \"float32\",\n \"float64\"\n ],\n \"complex_floating_point\": [\n \"complex64\",\n \"complex128\"\n ],\n \"integer\": [\n \"int16\",\n \"int32\",\n \"int8\",\n \"uint16\",\n \"uint32\",\n \"uint8\",\n \"uint8c\"\n ],\n \"signed_integer\": [\n \"int16\",\n \"int32\",\n \"int8\"\n ],\n \"unsigned_integer\": [\n \"uint16\",\n \"uint32\",\n \"uint8\",\n \"uint8c\"\n ],\n \"real\": [\n \"float32\",\n \"float64\",\n \"int16\",\n \"int32\",\n \"int8\",\n \"uint16\",\n \"uint32\",\n \"uint8\",\n \"uint8c\"\n ],\n \"numeric\": [\n \"complex64\",\n \"complex128\",\n \"float32\",\n \"float64\",\n \"int16\",\n \"int32\",\n \"int8\",\n \"uint16\",\n \"uint32\",\n \"uint8\",\n \"uint8c\"\n ]\n}\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// MODULES //\n\nvar replace = require( '@stdlib/string-base-replace' );\nvar DTYPES = require( './dtypes.json' );\n\n\n// VARIABLES //\n\nvar RE_SUFFIX = /_and_generic$/;\n\n\n// MAIN //\n\n/**\n* Returns a list of array data types.\n*\n* @param {string} [kind] - data type kind\n* @returns {StringArray} list of array data types\n*\n* @example\n* var list = dtypes();\n* // e.g., returns [ 'float32', 'float64', ... ]\n*\n* @example\n* var list = dtypes( 'floating_point' );\n* // returns [...]\n*/\nfunction dtypes() {\n\tvar kind;\n\tvar out;\n\tvar FLG;\n\tif ( arguments.length === 0 ) {\n\t\treturn DTYPES.all.slice();\n\t}\n\tFLG = false;\n\tkind = arguments[ 0 ];\n\tif ( RE_SUFFIX.test( kind ) ) {\n\t\tkind = replace( kind, RE_SUFFIX, '' );\n\t\tif ( kind !== 'all' ) {\n\t\t\tFLG = true;\n\t\t}\n\t}\n\tout = DTYPES[ kind ];\n\tout = ( out ) ? out.slice() : [];\n\tif ( FLG && out.length > 0 ) {\n\t\tout.push( 'generic' );\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = dtypes;\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* Return a list of array data types.\n*\n* @module @stdlib/array-dtypes\n*\n* @example\n* var dtypes = require( '@stdlib/array-dtypes' );\n*\n* var list = dtypes();\n* // e.g., returns [ 'float32', 'float64', 'generic', 'int16', 'int32', 'int8', 'uint16', 'uint32', 'uint8', 'uint8c', 'complex128', 'complex64' ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], | ||
| "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,CAAAA,EAAA,SACE,IAAO,CACL,YACA,aACA,UACA,UACA,UACA,QACA,QACA,OACA,SACA,SACA,QACA,QACF,EACA,MAAS,CACP,YACA,aACA,UACA,UACA,QACA,QACA,OACA,SACA,SACA,QACA,QACF,EACA,eAAkB,CAChB,YACA,aACA,UACA,SACF,EACA,oBAAuB,CACrB,UACA,SACF,EACA,uBAA0B,CACxB,YACA,YACF,EACA,QAAW,CACT,QACA,QACA,OACA,SACA,SACA,QACA,QACF,EACA,eAAkB,CAChB,QACA,QACA,MACF,EACA,iBAAoB,CAClB,SACA,SACA,QACA,QACF,EACA,KAAQ,CACN,UACA,UACA,QACA,QACA,OACA,SACA,SACA,QACA,QACF,EACA,QAAW,CACT,YACA,aACA,UACA,UACA,QACA,QACA,OACA,SACA,SACA,QACA,QACF,CACF,ICtFA,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAU,QAAS,6BAA8B,EACjDC,EAAS,IAKTC,EAAY,gBAmBhB,SAASC,GAAS,CACjB,IAAIC,EACAC,EACAC,EACJ,OAAK,UAAU,SAAW,EAClBL,EAAO,IAAI,MAAM,GAEzBK,EAAM,GACNF,EAAO,UAAW,CAAE,EACfF,EAAU,KAAME,CAAK,IACzBA,EAAOJ,EAASI,EAAMF,EAAW,EAAG,EAC/BE,IAAS,QACbE,EAAM,KAGRD,EAAMJ,EAAQG,CAAK,EACnBC,EAAQA,EAAQA,EAAI,MAAM,EAAI,CAAC,EAC1BC,GAAOD,EAAI,OAAS,GACxBA,EAAI,KAAM,SAAU,EAEdA,EACR,CAKAN,EAAO,QAAUI,ICvCjB,IAAII,EAAO,IAKX,OAAO,QAAUA", | ||
| "sourcesContent": ["{\n \"all\": [\n \"bool\",\n \"complex64\",\n \"complex128\",\n \"float32\",\n \"float64\",\n \"generic\",\n \"int16\",\n \"int32\",\n \"int8\",\n \"uint16\",\n \"uint32\",\n \"uint8\",\n \"uint8c\"\n ],\n \"typed\": [\n \"bool\",\n \"complex64\",\n \"complex128\",\n \"float32\",\n \"float64\",\n \"int16\",\n \"int32\",\n \"int8\",\n \"uint16\",\n \"uint32\",\n \"uint8\",\n \"uint8c\"\n ],\n \"floating_point\": [\n \"complex64\",\n \"complex128\",\n \"float32\",\n \"float64\"\n ],\n \"real_floating_point\": [\n \"float32\",\n \"float64\"\n ],\n \"complex_floating_point\": [\n \"complex64\",\n \"complex128\"\n ],\n \"boolean\": [\n \"bool\"\n ],\n \"integer\": [\n \"int16\",\n \"int32\",\n \"int8\",\n \"uint16\",\n \"uint32\",\n \"uint8\",\n \"uint8c\"\n ],\n \"signed_integer\": [\n \"int16\",\n \"int32\",\n \"int8\"\n ],\n \"unsigned_integer\": [\n \"uint16\",\n \"uint32\",\n \"uint8\",\n \"uint8c\"\n ],\n \"real\": [\n \"float32\",\n \"float64\",\n \"int16\",\n \"int32\",\n \"int8\",\n \"uint16\",\n \"uint32\",\n \"uint8\",\n \"uint8c\"\n ],\n \"numeric\": [\n \"complex64\",\n \"complex128\",\n \"float32\",\n \"float64\",\n \"int16\",\n \"int32\",\n \"int8\",\n \"uint16\",\n \"uint32\",\n \"uint8\",\n \"uint8c\"\n ]\n}\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// MODULES //\n\nvar replace = require( '@stdlib/string-base-replace' );\nvar DTYPES = require( './dtypes.json' );\n\n\n// VARIABLES //\n\nvar RE_SUFFIX = /_and_generic$/;\n\n\n// MAIN //\n\n/**\n* Returns a list of array data types.\n*\n* @param {string} [kind] - data type kind\n* @returns {StringArray} list of array data types\n*\n* @example\n* var list = dtypes();\n* // e.g., returns [ 'float32', 'float64', ... ]\n*\n* @example\n* var list = dtypes( 'floating_point' );\n* // returns [...]\n*/\nfunction dtypes() {\n\tvar kind;\n\tvar out;\n\tvar FLG;\n\tif ( arguments.length === 0 ) {\n\t\treturn DTYPES.all.slice();\n\t}\n\tFLG = false;\n\tkind = arguments[ 0 ];\n\tif ( RE_SUFFIX.test( kind ) ) {\n\t\tkind = replace( kind, RE_SUFFIX, '' );\n\t\tif ( kind !== 'all' ) {\n\t\t\tFLG = true;\n\t\t}\n\t}\n\tout = DTYPES[ kind ];\n\tout = ( out ) ? out.slice() : [];\n\tif ( FLG && out.length > 0 ) {\n\t\tout.push( 'generic' );\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = dtypes;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 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* Return a list of array data types.\n*\n* @module @stdlib/array-dtypes\n*\n* @example\n* var dtypes = require( '@stdlib/array-dtypes' );\n*\n* var list = dtypes();\n* // e.g., returns [ 'float32', 'float64', 'generic', 'int16', 'int32', 'int8', 'uint16', 'uint32', 'uint8', 'uint8c', 'complex128', 'complex64', 'bool' ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], | ||
| "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,CAAAA,EAAA,SACE,IAAO,CACL,OACA,YACA,aACA,UACA,UACA,UACA,QACA,QACA,OACA,SACA,SACA,QACA,QACF,EACA,MAAS,CACP,OACA,YACA,aACA,UACA,UACA,QACA,QACA,OACA,SACA,SACA,QACA,QACF,EACA,eAAkB,CAChB,YACA,aACA,UACA,SACF,EACA,oBAAuB,CACrB,UACA,SACF,EACA,uBAA0B,CACxB,YACA,YACF,EACA,QAAW,CACT,MACF,EACA,QAAW,CACT,QACA,QACA,OACA,SACA,SACA,QACA,QACF,EACA,eAAkB,CAChB,QACA,QACA,MACF,EACA,iBAAoB,CAClB,SACA,SACA,QACA,QACF,EACA,KAAQ,CACN,UACA,UACA,QACA,QACA,OACA,SACA,SACA,QACA,QACF,EACA,QAAW,CACT,YACA,aACA,UACA,UACA,QACA,QACA,OACA,SACA,SACA,QACA,QACF,CACF,IC3FA,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAU,QAAS,6BAA8B,EACjDC,EAAS,IAKTC,EAAY,gBAmBhB,SAASC,GAAS,CACjB,IAAIC,EACAC,EACAC,EACJ,OAAK,UAAU,SAAW,EAClBL,EAAO,IAAI,MAAM,GAEzBK,EAAM,GACNF,EAAO,UAAW,CAAE,EACfF,EAAU,KAAME,CAAK,IACzBA,EAAOJ,EAASI,EAAMF,EAAW,EAAG,EAC/BE,IAAS,QACbE,EAAM,KAGRD,EAAMJ,EAAQG,CAAK,EACnBC,EAAQA,EAAQA,EAAI,MAAM,EAAI,CAAC,EAC1BC,GAAOD,EAAI,OAAS,GACxBA,EAAI,KAAM,SAAU,EAEdA,EACR,CAKAN,EAAO,QAAUI,ICvCjB,IAAII,EAAO,IAKX,OAAO,QAAUA", | ||
| "names": ["require_dtypes", "__commonJSMin", "exports", "module", "require_main", "__commonJSMin", "exports", "module", "replace", "DTYPES", "RE_SUFFIX", "dtypes", "kind", "out", "FLG", "main"] | ||
| } |
+5
-0
| { | ||
| "all": [ | ||
| "bool", | ||
| "complex64", | ||
@@ -17,2 +18,3 @@ "complex128", | ||
| "typed": [ | ||
| "bool", | ||
| "complex64", | ||
@@ -44,2 +46,5 @@ "complex128", | ||
| ], | ||
| "boolean": [ | ||
| "bool" | ||
| ], | ||
| "integer": [ | ||
@@ -46,0 +51,0 @@ "int16", |
+2
-2
| /** | ||
| * @license Apache-2.0 | ||
| * | ||
| * Copyright (c) 2018 The Stdlib Authors. | ||
| * Copyright (c) 2024 The Stdlib Authors. | ||
| * | ||
@@ -30,3 +30,3 @@ * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * var list = dtypes(); | ||
| * // e.g., returns [ 'float32', 'float64', 'generic', 'int16', 'int32', 'int8', 'uint16', 'uint32', 'uint8', 'uint8c', 'complex128', 'complex64' ] | ||
| * // e.g., returns [ 'float32', 'float64', 'generic', 'int16', 'int32', 'int8', 'uint16', 'uint32', 'uint8', 'uint8c', 'complex128', 'complex64', 'bool' ] | ||
| */ | ||
@@ -33,0 +33,0 @@ |
+2
-2
| { | ||
| "name": "@stdlib/array-dtypes", | ||
| "version": "0.2.1", | ||
| "version": "0.3.0", | ||
| "description": "List of array data types.", | ||
@@ -33,3 +33,3 @@ "license": "Apache-2.0", | ||
| "dependencies": { | ||
| "@stdlib/string-base-replace": "^0.2.1" | ||
| "@stdlib/string-base-replace": "^0.2.2" | ||
| }, | ||
@@ -36,0 +36,0 @@ "devDependencies": {}, |
+9
-14
@@ -5,3 +5,3 @@ <!-- | ||
| Copyright (c) 2018 The Stdlib Authors. | ||
| Copyright (c) 2024 The Stdlib Authors. | ||
@@ -82,2 +82,3 @@ Licensed under the Apache License, Version 2.0 (the "License"); | ||
| - `complex128`: double-precision complex floating-point numbers. | ||
| - `bool`: boolean values. | ||
| - `generic`: values of any type. | ||
@@ -104,2 +105,3 @@ - `int16`: signed 16-bit integers. | ||
| - `complex_floating_point`: complex-valued floating-point data types. | ||
| - `boolean`: boolean data types. | ||
| - `integer`: integer data types. | ||
@@ -141,21 +143,14 @@ - `signed_integer`: signed integer data types. | ||
| ```javascript | ||
| var indexOf = require( '@stdlib/utils-index-of' ); | ||
| var contains = require( '@stdlib/array-base-assert-contains' ).factory; | ||
| var dtypes = require( '@stdlib/array-dtypes' ); | ||
| var DTYPES = dtypes(); | ||
| var isdtype = contains( dtypes() ); | ||
| function isdtype( str ) { | ||
| if ( indexOf( DTYPES, str ) === -1 ) { | ||
| return false; | ||
| } | ||
| return true; | ||
| } | ||
| var bool = isdtype( 'float64' ); | ||
| // returns true | ||
| bool = isdtype( 'int16' ); | ||
| bool = isdtype( 'int8' ); | ||
| // returns true | ||
| bool = isdtype( 'uint8' ); | ||
| bool = isdtype( 'uint16' ); | ||
| // returns true | ||
@@ -233,4 +228,4 @@ | ||
| [test-image]: https://github.com/stdlib-js/array-dtypes/actions/workflows/test.yml/badge.svg?branch=v0.2.1 | ||
| [test-url]: https://github.com/stdlib-js/array-dtypes/actions/workflows/test.yml?query=branch:v0.2.1 | ||
| [test-image]: https://github.com/stdlib-js/array-dtypes/actions/workflows/test.yml/badge.svg?branch=v0.3.0 | ||
| [test-url]: https://github.com/stdlib-js/array-dtypes/actions/workflows/test.yml?query=branch:v0.3.0 | ||
@@ -237,0 +232,0 @@ [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/array-dtypes/main.svg |
32326
0.64%236
2.61%268
-1.83%