2020
2121/// <reference types="@stdlib/types"/>
2222
23- import { RealOrComplexTypedArray } from '@stdlib/types/array' ;
23+ import { RealOrComplexTypedArray , Complex128Array , Complex64Array , DataType } from '@stdlib/types/array' ;
24+
25+ /**
26+ * Returns the data type of an array.
27+ *
28+ * @param value - input value
29+ * @returns data type
30+ *
31+ * @example
32+ * var dt = dtype( new Float64Array( [ 1, 2, 3 ] ) );
33+ * // returns 'float64'
34+ */
35+ declare function dtype ( value : Float64Array ) : 'float64' ;
36+
37+ /**
38+ * Returns the data type of an array.
39+ *
40+ * @param value - input value
41+ * @returns data type
42+ *
43+ * @example
44+ * var dt = dtype( new Float32Array( [ 1, 2, 3 ] ) );
45+ * // returns 'float32'
46+ */
47+ declare function dtype ( value : Float32Array ) : 'float32' ;
48+
49+ /**
50+ * Returns the data type of an array.
51+ *
52+ * @param value - input value
53+ * @returns data type
54+ *
55+ * @example
56+ * var Complex128Array = require( `@stdlib/array/complex128` );
57+ *
58+ * var dt = dtype( new Complex128Array( [ 1, 2, 3, 4 ] ) );
59+ * // returns 'complex128'
60+ */
61+ declare function dtype ( value : Complex128Array ) : 'complex128' ;
62+
63+ /**
64+ * Returns the data type of an array.
65+ *
66+ * @param value - input value
67+ * @returns data type
68+ *
69+ * @example
70+ * var Complex64Array = require( `@stdlib/array/complex64` );
71+ *
72+ * var dt = dtype( new Complex64Array( [ 1, 2, 3, 4 ] ) );
73+ * // returns 'complex64'
74+ */
75+ declare function dtype ( value : Complex64Array ) : 'complex64' ;
76+
77+ /**
78+ * Returns the data type of an array.
79+ *
80+ * @param value - input value
81+ * @returns data type
82+ *
83+ * @example
84+ * var dt = dtype( new Int32Array( [ 1, 2, 3 ] ) );
85+ * // returns 'int32'
86+ */
87+ declare function dtype ( value : Int32Array ) : 'int32' ;
88+
89+ /**
90+ * Returns the data type of an array.
91+ *
92+ * @param value - input value
93+ * @returns data type
94+ *
95+ * @example
96+ * var dt = dtype( new Int16Array( [ 1, 2, 3 ] ) );
97+ * // returns 'int16'
98+ */
99+ declare function dtype ( value : Int16Array ) : 'int16' ;
100+
101+ /**
102+ * Returns the data type of an array.
103+ *
104+ * @param value - input value
105+ * @returns data type
106+ *
107+ * @example
108+ * var dt = dtype( new Int8Array( [ 1, 2, 3 ] ) );
109+ * // returns 'int8'
110+ */
111+ declare function dtype ( value : Int8Array ) : 'int8' ;
112+
113+ /**
114+ * Returns the data type of an array.
115+ *
116+ * @param value - input value
117+ * @returns data type
118+ *
119+ * @example
120+ * var dt = dtype( new Uint32Array( [ 1, 2, 3 ] ) );
121+ * // returns 'uint32'
122+ */
123+ declare function dtype ( value : Uint32Array ) : 'uint32' ;
124+
125+ /**
126+ * Returns the data type of an array.
127+ *
128+ * @param value - input value
129+ * @returns data type
130+ *
131+ * @example
132+ * var dt = dtype( new Uint16Array( [ 1, 2, 3 ] ) );
133+ * // returns 'uint16'
134+ */
135+ declare function dtype ( value : Uint16Array ) : 'uint16' ;
136+
137+ /**
138+ * Returns the data type of an array.
139+ *
140+ * @param value - input value
141+ * @returns data type
142+ *
143+ * @example
144+ * var dt = dtype( new Uint8Array( [ 1, 2, 3 ] ) );
145+ * // returns 'uint8'
146+ */
147+ declare function dtype ( value : Uint8Array ) : 'uint8' ;
148+
149+ /**
150+ * Returns the data type of an array.
151+ *
152+ * @param value - input value
153+ * @returns data type
154+ *
155+ * @example
156+ * var dt = dtype( new Uint8ClampedArray( [ 1, 2, 3 ] ) );
157+ * // returns 'uint8c'
158+ */
159+ declare function dtype ( value : Uint8ClampedArray ) : 'uint8c' ;
160+
161+ /**
162+ * Returns the data type of an array.
163+ *
164+ * @param value - input value
165+ * @returns data type
166+ *
167+ * @example
168+ * var dt = dtype( [ 1, 2, 3 ] );
169+ * // returns 'generic'
170+ */
171+ declare function dtype ( value : Array < any > ) : 'generic' ;
24172
25173/**
26174* Returns the data type of an array.
@@ -39,7 +187,7 @@ import { RealOrComplexTypedArray } from '@stdlib/types/array';
39187* var dt = dtype( 'beep' );
40188* // returns null
41189*/
42- declare function dtype ( value : Array < any > | RealOrComplexTypedArray ) : string | null ; // tslint- disable-line max-line-length
190+ declare function dtype ( value : Array < any > | RealOrComplexTypedArray ) : DataType | null ; // tslint: disable-line: max-line-length
43191
44192
45193// EXPORTS //
0 commit comments