You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/node_modules/@stdlib/strided/dtypes/lib/str2enum.js
+7-6Lines changed: 7 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -31,25 +31,26 @@ var dt = dtypes();
31
31
// MAIN //
32
32
33
33
/**
34
-
* Returns the integer value associated with a supported dtype for purposes of C inter-operation.
34
+
* Returns the integer value associated with a supported dtype string for purposes of C inter-operation.
35
35
*
36
36
* ## Notes
37
37
*
38
38
* - Downstream consumers of this function should **not** rely on specific integer values (e.g., `INT8 == 0`). Instead, the function should be used in an opaque manner.
39
39
* - The main purpose of this function is JavaScript and C inter-operation of strided arrays.
40
40
*
41
-
* @param {string} dtype - data type
41
+
* @param {string} dtype - data type string
42
42
* @returns {(integer|void)} integer value or undefined
43
43
*
44
44
* @example
45
-
* var v = enumerator( 'int8' );
45
+
* var v = str2enum( 'int8' );
46
46
* // returns <number>
47
47
*/
48
-
functionenumerator(dtype){
49
-
returndt[dtype];
48
+
functionstr2enum(dtype){
49
+
varv=dt[dtype];
50
+
return(typeofv==='number') ? v : void0;// note: we include this guard to prevent walking the prototype chain
Copy file name to clipboardExpand all lines: lib/node_modules/@stdlib/strided/dtypes/test/test.js
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -98,14 +98,14 @@ tape( 'attached to the main function is an `enum` method to return an object map
98
98
t.end();
99
99
});
100
100
101
-
tape('attached to the main function is an `enumerator` method to the integer value associated with a provided dtype for C inter-operation',functiontest(t){
101
+
tape('attached to the main function is a `str2enum` method to retrieve the integer value associated with a provided dtype string for C inter-operation',functiontest(t){
0 commit comments