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: CHANGELOG.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,11 @@
10
10
11
11
### Features
12
12
13
+
-[`4b6bce8`](https://github.com/stdlib-js/stdlib/commit/4b6bce89254cfbbe7a008167ce7b4eccceaaea7e) - add support for non-string data types
14
+
-[`55e56f0`](https://github.com/stdlib-js/stdlib/commit/55e56f0b239268c250b9e64d46f5914d24229e1b) - add support for non-string data types
15
+
-[`a74c0e2`](https://github.com/stdlib-js/stdlib/commit/a74c0e2e7efd0b76b251d895f43d5c197512ba2b) - add support for non-string data types
16
+
-[`6dd3bf6`](https://github.com/stdlib-js/stdlib/commit/6dd3bf6252e3808803c6a5ea00925247b592bd01) - add support for non-string data types
17
+
-[`96ea877`](https://github.com/stdlib-js/stdlib/commit/96ea8778698f2979de10ac6d62d91b0d6bd65cae) - add support for struct and data type objects
13
18
-[`25164a7`](https://github.com/stdlib-js/stdlib/commit/25164a7ae8ac5285255e2d8097f3e123d9db3a38) - add support for non-string data types
14
19
-[`c6ce94c`](https://github.com/stdlib-js/stdlib/commit/c6ce94c5cf69a183cbe369a56411192d8d99abe1) - add support for non-string data types
15
20
-[`360ed63`](https://github.com/stdlib-js/stdlib/commit/360ed63a0e83c2cc4261df2b6075e1cc2c8f5dec) - add support for non-string data tpes
@@ -566,6 +571,13 @@ A total of 24 issues were closed in this release:
566
571
567
572
<details>
568
573
574
+
-[`4b6bce8`](https://github.com/stdlib-js/stdlib/commit/4b6bce89254cfbbe7a008167ce7b4eccceaaea7e) - **feat:** add support for non-string data types _(by Athan Reines)_
575
+
-[`55e56f0`](https://github.com/stdlib-js/stdlib/commit/55e56f0b239268c250b9e64d46f5914d24229e1b) - **feat:** add support for non-string data types _(by Athan Reines)_
576
+
-[`a74c0e2`](https://github.com/stdlib-js/stdlib/commit/a74c0e2e7efd0b76b251d895f43d5c197512ba2b) - **feat:** add support for non-string data types _(by Athan Reines)_
-[`6dd3bf6`](https://github.com/stdlib-js/stdlib/commit/6dd3bf6252e3808803c6a5ea00925247b592bd01) - **feat:** add support for non-string data types _(by Athan Reines)_
579
+
-[`96ea877`](https://github.com/stdlib-js/stdlib/commit/96ea8778698f2979de10ac6d62d91b0d6bd65cae) - **feat:** add support for struct and data type objects _(by Athan Reines)_
580
+
-[`7b1d601`](https://github.com/stdlib-js/stdlib/commit/7b1d6010a2b93231101815666acb7620185b650a) - **refactor:** use assertion utility _(by Athan Reines)_
569
581
-[`25164a7`](https://github.com/stdlib-js/stdlib/commit/25164a7ae8ac5285255e2d8097f3e123d9db3a38) - **feat:** add support for non-string data types _(by Athan Reines)_
570
582
-[`c6ce94c`](https://github.com/stdlib-js/stdlib/commit/c6ce94c5cf69a183cbe369a56411192d8d99abe1) - **feat:** add support for non-string data types _(by Athan Reines)_
571
583
-[`360ed63`](https://github.com/stdlib-js/stdlib/commit/360ed63a0e83c2cc4261df2b6075e1cc2c8f5dec) - **feat:** add support for non-string data tpes _(by Athan Reines)_
Copy file name to clipboardExpand all lines: base/assert/is-mostly-safe-data-type-cast/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,7 @@ var isMostlySafeCast = require( '@stdlib/ndarray/base/assert/is-mostly-safe-data
42
42
43
43
#### isMostlySafeCast( from, to )
44
44
45
-
Returns a `boolean` indicating whether an ndarray [data type][@stdlib/ndarray/dtypes] can be safely cast or, for floating-point data types, downcast to another ndarray [data type][@stdlib/ndarray/dtypes].
45
+
Returns a boolean indicating whether an ndarray [data type][@stdlib/ndarray/dtypes] can be safely cast or, for floating-point data types, downcast to another ndarray [data type][@stdlib/ndarray/dtypes].
46
46
47
47
```javascript
48
48
var bool =isMostlySafeCast( 'float32', 'float64' );
Copy file name to clipboardExpand all lines: base/assert/is-mostly-safe-data-type-cast/docs/types/index.d.ts
+5-1Lines changed: 5 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,10 @@
18
18
19
19
// TypeScript Version: 4.1
20
20
21
+
/// <reference types="@stdlib/types"/>
22
+
23
+
import{DataType}from'@stdlib/types/ndarray';
24
+
21
25
/**
22
26
* Returns a boolean indicating if a provided ndarray data type can be safely cast or, for floating-point data types, downcast to another ndarray data type.
* Returns a boolean indicating if a provided ndarray data type can be safely cast or, for floating-point data types, downcast to another ndarray data type.
35
36
*
36
-
* @param {string} from - ndarray data type
37
-
* @param {string} to - ndarray data type
37
+
* @param {*} from - ndarray data type
38
+
* @param {*} to - ndarray data type
38
39
* @returns {boolean} boolean indicating if a data type can be cast to another data type
39
40
*
40
41
* @example
@@ -45,10 +46,17 @@ var TABLE = casts();
45
46
* // returns false
46
47
*/
47
48
functionisMostlySafeCast(from,to){
48
-
if(from===to){
49
+
vart;
50
+
from=resolveStr(from);
51
+
to=resolveStr(to);
52
+
if(from===to){// note: for "struct" data types, require strict equality to be considered a "mostly" safe cast
t.strictEqual(actual,expected,'returns expected value. from: '+dt+'. to: '+DTYPES[j]+'.');
79
+
}
80
+
}
81
+
t.end();
82
+
});
83
+
84
+
tape('the function returns a boolean indicating if an ndarray data type can be cast to another ndarray data type (data type, strings)',functiontest(t){
0 commit comments