Skip to content

Commit 1eafb04

Browse files
committed
Auto-generated commit
1 parent caa2fa1 commit 1eafb04

File tree

3 files changed

+136
-6
lines changed

3 files changed

+136
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
<section class="release" id="unreleased">
66

7-
## Unreleased (2024-10-03)
7+
## Unreleased (2024-10-08)
88

99
<section class="packages">
1010

@@ -697,14 +697,15 @@ A total of 3 issues were closed in this release:
697697

698698
### Contributors
699699

700-
A total of 8 people contributed to this release. Thank you to the following contributors:
700+
A total of 9 people contributed to this release. Thank you to the following contributors:
701701

702702
- Aditya Sapra
703703
- Athan Reines
704704
- Debashis Maharana
705705
- HarshaNP
706706
- Kaif Mohd
707707
- Philipp Burckhardt
708+
- Soumajit Chatterjee
708709
- Vaibhav Patel
709710
- yaswanth
710711

@@ -718,6 +719,7 @@ A total of 8 people contributed to this release. Thank you to the following cont
718719

719720
<details>
720721

722+
- [`c00f27a`](https://github.com/stdlib-js/stdlib/commit/c00f27afb4b1853a7f4377fbbab7aec1dab9e34c) - **docs:** improve examples of `array/base/assert` namespace _(by Soumajit Chatterjee, Philipp Burckhardt)_
721723
- [`ca2fbd0`](https://github.com/stdlib-js/stdlib/commit/ca2fbd0beec71a0f41307b19939b2c8dd27c76a9) - **chore:** minor clean-up _(by Philipp Burckhardt)_
722724
- [`89e005a`](https://github.com/stdlib-js/stdlib/commit/89e005ad5004d32271fe7266e95eb96187c1946a) - **chore:** minor clean-up _(by Philipp Burckhardt)_
723725
- [`2c4e5d8`](https://github.com/stdlib-js/stdlib/commit/2c4e5d824e0c5dc8fd536bf79ff565cee100ce46) - **build:** disable additional lint rule in TS tests _(by Philipp Burckhardt)_

base/assert/README.md

Lines changed: 66 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,74 @@ The namespace exports the following:
8383
<!-- eslint no-undef: "error" -->
8484

8585
```javascript
86-
var objectKeys = require( '@stdlib/utils/keys' );
8786
var ns = require( '@stdlib/array/base/assert' );
87+
var dtype = require( '@stdlib/array/dtype' );
88+
var Float64Array = require( '@stdlib/array/float64' );
89+
var Int32Array = require( '@stdlib/array/int32' );
90+
var Uint8Array = require( '@stdlib/array/uint8' );
91+
var Complex128Array = require( '@stdlib/array/complex128' );
8892

89-
console.log( objectKeys( ns ) );
93+
// Create various arrays:
94+
var arr1 = new Float64Array( [ 1.1, 2.2, 3.3 ] );
95+
var arr2 = new Int32Array( [ 1, 2, 3 ] );
96+
var arr3 = new Uint8Array( [ 1, 2, 3 ] );
97+
var arr4 = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0 ] ); // two complex numbers: 1+1i, 2+2i
98+
99+
// Get data types:
100+
var dt1 = dtype( arr1 );
101+
var dt2 = dtype( arr2 );
102+
var dt3 = dtype( arr3 );
103+
var dt4 = dtype( arr4 );
104+
105+
// Check data types:
106+
console.log( dt1 + ' is floating-point data type: ' + ns.isFloatingPointDataType( dt1 ) );
107+
// => 'float64 is floating-point data type: true'
108+
109+
console.log( dt2 + ' is integer data type: ' + ns.isIntegerDataType( dt2 ) );
110+
// => 'int32 is integer data type: true'
111+
112+
console.log( dt3 + ' is unsigned integer data type: ' + ns.isUnsignedIntegerDataType( dt3 ) );
113+
// => 'uint8 is unsigned integer data type: true'
114+
115+
console.log( dt4 + ' is complex floating-point data type: ' + ns.isComplexFloatingPointDataType( dt4 ) );
116+
// => 'complex128 is complex floating-point data type: true'
117+
118+
// Check if arrays have the same values:
119+
console.log( 'arr2 and arr3 have same values: ' + ns.hasSameValues( arr2, arr3 ) );
120+
// => 'arr2 and arr3 have same values: true'
121+
122+
console.log( 'arr1 and arr2 have same values: ' + ns.hasSameValues( arr1, arr2 ) );
123+
// => 'arr1 and arr2 have same values: false'
124+
125+
// Check safe data type casts:
126+
console.log( 'Can safely cast from ' + dt2 + ' to ' + dt1 + ': ' + ns.isSafeDataTypeCast( dt2, dt1 ) );
127+
// => 'Can safely cast from int32 to float64: true'
128+
129+
console.log( 'Can safely cast from ' + dt1 + ' to ' + dt2 + ': ' + ns.isSafeDataTypeCast( dt1, dt2 ) );
130+
// => 'Can safely cast from float64 to int32: false'
131+
132+
console.log( 'Can safely cast from ' + dt3 + ' to ' + dt2 + ': ' + ns.isSafeDataTypeCast( dt3, dt2 ) );
133+
// => 'Can safely cast from uint8 to int32: true'
134+
135+
console.log( 'Can safely cast from ' + dt4 + ' to ' + dt1 + ': ' + ns.isSafeDataTypeCast( dt4, dt1 ) );
136+
// => 'Can safely cast from complex128 to float64: false'
137+
138+
// Check if arrays contain specific values:
139+
console.log( 'arr1 contains 2.2: ' + ns.contains( arr1, 2.2 ) );
140+
// => 'arr1 contains 2.2: true'
141+
142+
console.log( 'arr2 contains 2: ' + ns.contains( arr2, 2 ) );
143+
// => 'arr2 contains 2: true'
144+
145+
console.log( 'arr2 contains 2.2: ' + ns.contains( arr2, 2.2 ) );
146+
// => 'arr2 contains 2.2: false'
147+
148+
// Check complex array types:
149+
console.log( 'arr4 is Complex128Array: ' + ns.isComplex128Array( arr4 ) );
150+
// => 'arr4 is Complex128Array: true'
151+
152+
console.log( 'arr4 is complex typed array: ' + ns.isComplexTypedArray( arr4 ) );
153+
// => 'arr4 is complex typed array: true'
90154
```
91155

92156
</section>

base/assert/examples/index.js

Lines changed: 66 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,71 @@
1818

1919
'use strict';
2020

21-
var objectKeys = require( '@stdlib/utils/keys' );
21+
var dtype = require( './../../../dtype' );
22+
var Float64Array = require( './../../../float64' );
23+
var Int32Array = require( './../../../int32' );
24+
var Uint8Array = require( './../../../uint8' );
25+
var Complex128Array = require( './../../../complex128' );
2226
var ns = require( './../lib' );
2327

24-
console.log( objectKeys( ns ) );
28+
// Create various arrays:
29+
var arr1 = new Float64Array( [ 1.1, 2.2, 3.3 ] );
30+
var arr2 = new Int32Array( [ 1, 2, 3 ] );
31+
var arr3 = new Uint8Array( [ 1, 2, 3 ] );
32+
var arr4 = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0 ] ); // two complex numbers: 1+1i, 2+2i
33+
34+
// Get data types:
35+
var dt1 = dtype( arr1 );
36+
var dt2 = dtype( arr2 );
37+
var dt3 = dtype( arr3 );
38+
var dt4 = dtype( arr4 );
39+
40+
// Check data types:
41+
console.log( dt1 + ' is floating-point data type: ' + ns.isFloatingPointDataType( dt1 ) );
42+
// => 'float64 is floating-point data type: true'
43+
44+
console.log( dt2 + ' is integer data type: ' + ns.isIntegerDataType( dt2 ) );
45+
// => 'int32 is integer data type: true'
46+
47+
console.log( dt3 + ' is unsigned integer data type: ' + ns.isUnsignedIntegerDataType( dt3 ) );
48+
// => 'uint8 is unsigned integer data type: true'
49+
50+
console.log( dt4 + ' is complex floating-point data type: ' + ns.isComplexFloatingPointDataType( dt4 ) );
51+
// => 'complex128 is complex floating-point data type: true'
52+
53+
// Check if arrays have the same values:
54+
console.log( 'arr2 and arr3 have same values: ' + ns.hasSameValues( arr2, arr3 ) );
55+
// => 'arr2 and arr3 have same values: true'
56+
57+
console.log( 'arr1 and arr2 have same values: ' + ns.hasSameValues( arr1, arr2 ) );
58+
// => 'arr1 and arr2 have same values: false'
59+
60+
// Check safe data type casts:
61+
console.log( 'Can safely cast from ' + dt2 + ' to ' + dt1 + ': ' + ns.isSafeDataTypeCast( dt2, dt1 ) );
62+
// => 'Can safely cast from int32 to float64: true'
63+
64+
console.log( 'Can safely cast from ' + dt1 + ' to ' + dt2 + ': ' + ns.isSafeDataTypeCast( dt1, dt2 ) );
65+
// => 'Can safely cast from float64 to int32: false'
66+
67+
console.log( 'Can safely cast from ' + dt3 + ' to ' + dt2 + ': ' + ns.isSafeDataTypeCast( dt3, dt2 ) );
68+
// => 'Can safely cast from uint8 to int32: true'
69+
70+
console.log( 'Can safely cast from ' + dt4 + ' to ' + dt1 + ': ' + ns.isSafeDataTypeCast( dt4, dt1 ) );
71+
// => 'Can safely cast from complex128 to float64: false'
72+
73+
// Check if arrays contain specific values:
74+
console.log( 'arr1 contains 2.2: ' + ns.contains( arr1, 2.2 ) );
75+
// => 'arr1 contains 2.2: true'
76+
77+
console.log( 'arr2 contains 2: ' + ns.contains( arr2, 2 ) );
78+
// => 'arr2 contains 2: true'
79+
80+
console.log( 'arr2 contains 2.2: ' + ns.contains( arr2, 2.2 ) );
81+
// => 'arr2 contains 2.2: false'
82+
83+
// Check complex array types:
84+
console.log( 'arr4 is Complex128Array: ' + ns.isComplex128Array( arr4 ) );
85+
// => 'arr4 is Complex128Array: true'
86+
87+
console.log( 'arr4 is complex typed array: ' + ns.isComplexTypedArray( arr4 ) );
88+
// => 'arr4 is complex typed array: true'

0 commit comments

Comments
 (0)