🚨 Active Supply Chain Attack:node-ipc Package Compromised.Learn More
Socket
Book a DemoSign in
Socket

@stdlib/array-dtypes

Package Overview
Dependencies
Maintainers
4
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stdlib/array-dtypes - npm Package Compare versions

Comparing version
0.1.0
to
0.2.0
+5
SECURITY.md
# Security
> Policy for reporting security vulnerabilities.
See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security).
+3
-3

@@ -1,5 +0,5 @@

"use strict";var e=function(u,t){return function(){return t||u((t={exports:{}}).exports,t),t.exports}};var i=e(function(p,c){c.exports=["float32","float64","generic","int16","int32","int8","uint16","uint32","uint8","uint8c","complex64","complex128"]});var n=e(function(x,r){
var s=i();function o(){return s.slice()}r.exports=o
});var a=n();module.exports=a;
"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;
/** @license Apache-2.0 */
//# sourceMappingURL=index.js.map
{
"version": 3,
"sources": ["../lib/dtypes.json", "../lib/main.js", "../lib/index.js"],
"sourcesContent": ["[\n\t\"float32\",\n\t\"float64\",\n\t\"generic\",\n\t\"int16\",\n\t\"int32\",\n\t\"int8\",\n\t\"uint16\",\n\t\"uint32\",\n\t\"uint8\",\n\t\"uint8c\",\n \"complex64\",\n \"complex128\"\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 DTYPES = require( './dtypes.json' );\n\n\n// MAIN //\n\n/**\n* Returns a list of array data types.\n*\n* @returns {StringArray} list of array data types\n*\n* @example\n* var list = dtypes();\n* // e.g., returns [ 'float32', 'float64', 'generic', 'int16', 'int32', 'int8', 'uint16', 'uint32', 'uint8', 'uint8c', 'complex64', 'complex128' ]\n*/\nfunction dtypes() {\n\treturn DTYPES.slice();\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,SACC,UACA,UACA,UACA,QACA,QACA,OACA,SACA,SACA,QACA,SACC,YACA,YACF,ICbA,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,IAcb,SAASC,GAAS,CACjB,OAAOD,EAAO,MAAM,CACrB,CAKAD,EAAO,QAAUE,ICTjB,IAAIC,EAAO,IAKX,OAAO,QAAUA",
"names": ["require_dtypes", "__commonJSMin", "exports", "module", "require_main", "__commonJSMin", "exports", "module", "DTYPES", "dtypes", "main"]
"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",
"names": ["require_dtypes", "__commonJSMin", "exports", "module", "require_main", "__commonJSMin", "exports", "module", "replace", "DTYPES", "RE_SUFFIX", "dtypes", "kind", "out", "FLG", "main"]
}

@@ -23,3 +23,3 @@ /*

import { DataType } from '@stdlib/types/array';
import { DataType, DataTypeKind } from '@stdlib/types/array';

@@ -29,2 +29,3 @@ /**

*
* @param kind - data type kind
* @returns list of array data types

@@ -34,5 +35,9 @@ *

* var list = dtypes();
* // e.g., returns [ 'float32', 'float64', 'generic', 'int16', 'int32', 'int8', 'uint16', 'uint32', 'uint8', 'uint8c', 'complex64', 'complex128' ]
* // e.g., returns [ 'float32', 'float64', ... ]
*
* @example
* var list = dtypes( 'floating_point' );
* // returns [...]
*/
declare function dtypes(): Array<DataType>;
declare function dtypes( kind?: DataTypeKind ): Array<DataType>;

@@ -39,0 +44,0 @@

@@ -1,14 +0,87 @@

[
"float32",
"float64",
"generic",
"int16",
"int32",
"int8",
"uint16",
"uint32",
"uint8",
"uint8c",
"complex64",
"complex128"
]
{
"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"
]
}

@@ -23,5 +23,11 @@ /**

var replace = require( '@stdlib/string-base-replace' );
var DTYPES = require( './dtypes.json' );
// VARIABLES //
var RE_SUFFIX = /_and_generic$/;
// MAIN //

@@ -32,2 +38,3 @@

*
* @param {string} [kind] - data type kind
* @returns {StringArray} list of array data types

@@ -37,6 +44,29 @@ *

* var list = dtypes();
* // e.g., returns [ 'float32', 'float64', 'generic', 'int16', 'int32', 'int8', 'uint16', 'uint32', 'uint8', 'uint8c', 'complex64', 'complex128' ]
* // e.g., returns [ 'float32', 'float64', ... ]
*
* @example
* var list = dtypes( 'floating_point' );
* // returns [...]
*/
function dtypes() {
return DTYPES.slice();
var kind;
var out;
var FLG;
if ( arguments.length === 0 ) {
return DTYPES.all.slice();
}
FLG = false;
kind = arguments[ 0 ];
if ( RE_SUFFIX.test( kind ) ) {
kind = replace( kind, RE_SUFFIX, '' );
if ( kind !== 'all' ) {
FLG = true;
}
}
out = DTYPES[ kind ];
out = ( out ) ? out.slice() : [];
if ( FLG && out.length > 0 ) {
out.push( 'generic' );
}
return out;
}

@@ -43,0 +73,0 @@

+1
-1

@@ -1,1 +0,1 @@

Copyright (c) 2016-2023 The Stdlib Authors.
Copyright (c) 2016-2024 The Stdlib Authors.
{
"name": "@stdlib/array-dtypes",
"version": "0.1.0",
"version": "0.2.0",
"description": "List of array data types.",

@@ -40,11 +40,13 @@ "license": "Apache-2.0",

"dependencies": {
"@stdlib/types": "^0.1.0"
"@stdlib/string-base-replace": "^0.2.0",
"@stdlib/types": "^0.3.1"
},
"devDependencies": {
"@stdlib/assert-is-string-array": "^0.1.0",
"@stdlib/bench": "^0.1.0",
"@stdlib/assert-is-string-array": "^0.1.1",
"@stdlib/utils-index-of": "^0.1.0",
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
"istanbul": "^0.4.1",
"tap-min": "git+https://github.com/Planeshifter/tap-min.git"
"tap-min": "git+https://github.com/Planeshifter/tap-min.git",
"@stdlib/bench-harness": "^0.2.0",
"@stdlib/bench": "^0.3.1"
},

@@ -51,0 +53,0 @@ "engines": {

@@ -66,3 +66,3 @@ <!--

#### dtypes()
#### dtypes( \[kind] )

@@ -73,6 +73,6 @@ Returns a list of array data types.

var out = dtypes();
// e.g., returns [ 'float32', 'float64', 'generic', 'int16', 'int32', 'int8', 'uint16', 'uint32', 'uint8', 'uint8c', 'complex64', 'complex128' ]
// e.g., returns [ 'float32', 'float64', ... ]
```
The output `array` contains the following data types:
When not provided a data type "kind", the function returns an array containing the following data types:

@@ -92,2 +92,29 @@ - `float32`: single-precision floating-point numbers.

To return the subset of data types belonging to a specified data type kind, provide a `kind` argument.
```javascript
var out = dtypes( 'floating_point' );
// returns [...]
```
The function supports the following data type kinds:
- `floating_point`: floating-point data types.
- `real_floating_point`: real-valued floating-point data types.
- `complex_floating_point`: complex-valued floating-point data types.
- `integer`: integer data types.
- `signed_integer`: signed integer data types.
- `unsigned_integer`: unsigned integer data types.
- `real`: real-valued data types.
- `numeric`: numeric data types.
- `typed`: typed data types.
- `all`: all data types.
Additionally, the function supports extending the "kinds" listed above by appending an `_and_generic` suffix to the kind name (e.g., `real_and_generic`).
```javascript
var out = dtypes( 'floating_point_and_generic' );
// returns [...]
```
</section>

@@ -118,3 +145,2 @@

var DTYPES = dtypes();
var bool;

@@ -128,3 +154,3 @@ function isdtype( str ) {

bool = isdtype( 'float64' );
var bool = isdtype( 'float64' );
// returns true

@@ -195,3 +221,3 @@

Copyright &copy; 2016-2023. The Stdlib [Authors][stdlib-authors].
Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].

@@ -209,4 +235,4 @@ </section>

[test-image]: https://github.com/stdlib-js/array-dtypes/actions/workflows/test.yml/badge.svg?branch=v0.1.0
[test-url]: https://github.com/stdlib-js/array-dtypes/actions/workflows/test.yml?query=branch:v0.1.0
[test-image]: https://github.com/stdlib-js/array-dtypes/actions/workflows/test.yml/badge.svg?branch=v0.2.0
[test-url]: https://github.com/stdlib-js/array-dtypes/actions/workflows/test.yml?query=branch:v0.2.0

@@ -234,4 +260,7 @@ [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/array-dtypes/main.svg

[deno-url]: https://github.com/stdlib-js/array-dtypes/tree/deno
[deno-readme]: https://github.com/stdlib-js/array-dtypes/blob/deno/README.md
[umd-url]: https://github.com/stdlib-js/array-dtypes/tree/umd
[umd-readme]: https://github.com/stdlib-js/array-dtypes/blob/umd/README.md
[esm-url]: https://github.com/stdlib-js/array-dtypes/tree/esm
[esm-readme]: https://github.com/stdlib-js/array-dtypes/blob/esm/README.md
[branches-url]: https://github.com/stdlib-js/array-dtypes/blob/main/branches.md

@@ -238,0 +267,0 @@

Sorry, the diff of this file is not supported yet