Skip to content

Commit 8d5dd04

Browse files
committed
Auto-generated commit
1 parent 0e823ea commit 8d5dd04

File tree

24 files changed

+1160
-0
lines changed

24 files changed

+1160
-0
lines changed

CHANGELOG.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,28 @@
1010

1111
### Packages
1212

13+
<section class="package" id="array-unreleased">
14+
15+
#### [@stdlib/array](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array)
16+
17+
<details>
18+
19+
<section class="features">
20+
21+
##### Features
22+
23+
- [`444e453`](https://github.com/stdlib-js/stdlib/commit/444e45363e751ab85736bc97b642520c3e5db301) - add `byteOrders` to namespace
24+
25+
</section>
26+
27+
<!-- /.features -->
28+
29+
</details>
30+
31+
</section>
32+
33+
<!-- /.package -->
34+
1335
<section class="package" id="array-base-unreleased">
1436

1537
#### [@stdlib/array/base](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base)
@@ -42,6 +64,7 @@
4264

4365
##### Features
4466

67+
- [`43aa58f`](https://github.com/stdlib-js/stdlib/commit/43aa58f81dcad604f11a5715a1546c015b0a9623) - add `isByteOrder` to namespace
4568
- [`81b39fe`](https://github.com/stdlib-js/stdlib/commit/81b39fec06b8575149b2ab1b834a7577e6ac5e5d) - add `hasEqualValuesIndexed` to namespace
4669
- [`cc56538`](https://github.com/stdlib-js/stdlib/commit/cc5653806325fe7b63037dfa49108be8016de3fc) - add `hasEqualValues` to namespace
4770

@@ -99,6 +122,28 @@
99122

100123
<!-- /.package -->
101124

125+
<section class="package" id="array-base-assert-is-byte-order-unreleased">
126+
127+
#### [@stdlib/array/base/assert/is-byte-order](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/assert/is-byte-order)
128+
129+
<details>
130+
131+
<section class="features">
132+
133+
##### Features
134+
135+
- [`b18478e`](https://github.com/stdlib-js/stdlib/commit/b18478e236e9cb6991d5a0f952d217e043e46587) - add `array/base/assert/is-byte-order`
136+
137+
</section>
138+
139+
<!-- /.features -->
140+
141+
</details>
142+
143+
</section>
144+
145+
<!-- /.package -->
146+
102147
<section class="package" id="array-base-cunone-by-unreleased">
103148

104149
#### [@stdlib/array/base/cunone-by](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/cunone-by)
@@ -219,6 +264,28 @@
219264

220265
<!-- /.package -->
221266

267+
<section class="package" id="array-byte-orders-unreleased">
268+
269+
#### [@stdlib/array/byte-orders](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/byte-orders)
270+
271+
<details>
272+
273+
<section class="features">
274+
275+
##### Features
276+
277+
- [`20c443d`](https://github.com/stdlib-js/stdlib/commit/20c443df29e4120f66b3b61fc7ec063f0f6ca8c6) - add `array/byte-orders`
278+
279+
</section>
280+
281+
<!-- /.features -->
282+
283+
</details>
284+
285+
</section>
286+
287+
<!-- /.package -->
288+
222289
<section class="package" id="array-complex128-unreleased">
223290

224291
#### [@stdlib/array/complex128](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/complex128)
@@ -333,6 +400,10 @@ A total of 5 people contributed to this release. Thank you to the following cont
333400

334401
<details>
335402

403+
- [`43aa58f`](https://github.com/stdlib-js/stdlib/commit/43aa58f81dcad604f11a5715a1546c015b0a9623) - **feat:** add `isByteOrder` to namespace _(by Athan Reines)_
404+
- [`b18478e`](https://github.com/stdlib-js/stdlib/commit/b18478e236e9cb6991d5a0f952d217e043e46587) - **feat:** add `array/base/assert/is-byte-order` _(by Athan Reines)_
405+
- [`444e453`](https://github.com/stdlib-js/stdlib/commit/444e45363e751ab85736bc97b642520c3e5db301) - **feat:** add `byteOrders` to namespace _(by Athan Reines)_
406+
- [`20c443d`](https://github.com/stdlib-js/stdlib/commit/20c443df29e4120f66b3b61fc7ec063f0f6ca8c6) - **feat:** add `array/byte-orders` _(by Athan Reines)_
336407
- [`42664da`](https://github.com/stdlib-js/stdlib/commit/42664dafb94e72a8b8eca80ede6669caaaf57e68) - **feat:** add `nulls` to namespace _(by Athan Reines)_
337408
- [`6d91993`](https://github.com/stdlib-js/stdlib/commit/6d9199381c3e949420349ba3506ecd59c692be44) - **feat:** add `array/base/nulls` _(by Athan Reines)_
338409
- [`b723a6e`](https://github.com/stdlib-js/stdlib/commit/b723a6eaec97adad2da4ffbecb532a3d1ae1e0ba) - **docs:** fix errors in comments and clean-up _(by Philipp Burckhardt)_

base/assert/is-byte-order/README.md

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
<!--
2+
3+
@license Apache-2.0
4+
5+
Copyright (c) 2024 The Stdlib Authors.
6+
7+
Licensed under the Apache License, Version 2.0 (the "License");
8+
you may not use this file except in compliance with the License.
9+
You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
19+
-->
20+
21+
# isByteOrder
22+
23+
> Test if an input value is a supported array byte order.
24+
25+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
26+
27+
<section class="intro">
28+
29+
</section>
30+
31+
<!-- /.intro -->
32+
33+
<!-- Package usage documentation. -->
34+
35+
<section class="usage">
36+
37+
## Usage
38+
39+
```javascript
40+
var isByteOrder = require( '@stdlib/array/base/assert/is-byte-order' );
41+
```
42+
43+
#### isByteOrder( value )
44+
45+
Tests if an input `value` is a supported array byte order.
46+
47+
```javascript
48+
var bool = isByteOrder( 'little-endian' );
49+
// returns true
50+
51+
bool = isByteOrder( 'big-endian' );
52+
// returns true
53+
```
54+
55+
</section>
56+
57+
<!-- /.usage -->
58+
59+
<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
60+
61+
<section class="notes">
62+
63+
</section>
64+
65+
<!-- /.notes -->
66+
67+
<!-- Package usage examples. -->
68+
69+
<section class="examples">
70+
71+
## Examples
72+
73+
<!-- eslint no-undef: "error" -->
74+
75+
```javascript
76+
var isByteOrder = require( '@stdlib/array/base/assert/is-byte-order' );
77+
78+
var bool = isByteOrder( 'little-endian' );
79+
// returns true
80+
81+
bool = isByteOrder( 'big-endian' );
82+
// returns true
83+
84+
bool = isByteOrder( '' );
85+
// returns false
86+
87+
bool = isByteOrder( 'foo' );
88+
// returns false
89+
```
90+
91+
</section>
92+
93+
<!-- /.examples -->
94+
95+
<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
96+
97+
<section class="references">
98+
99+
</section>
100+
101+
<!-- /.references -->
102+
103+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
104+
105+
<section class="related">
106+
107+
</section>
108+
109+
<!-- /.related -->
110+
111+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
112+
113+
<section class="links">
114+
115+
</section>
116+
117+
<!-- /.links -->
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2024 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var bench = require( '@stdlib/bench' );
24+
var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive;
25+
var pkg = require( './../package.json' ).name;
26+
var isByteOrder = require( './../lib' );
27+
28+
29+
// MAIN //
30+
31+
bench( pkg, function benchmark( b ) {
32+
var values;
33+
var out;
34+
var v;
35+
var i;
36+
37+
values = [
38+
'little-endian',
39+
'big-endian',
40+
'foo',
41+
'bar',
42+
'',
43+
'beep',
44+
'boop'
45+
];
46+
47+
b.tic();
48+
for ( i = 0; i < b.iterations; i++ ) {
49+
v = values[ i%values.length ];
50+
out = isByteOrder( v );
51+
if ( typeof out !== 'boolean' ) {
52+
b.fail( 'should return a boolean' );
53+
}
54+
}
55+
b.toc();
56+
if ( !isBoolean( out ) ) {
57+
b.fail( 'should return a boolean' );
58+
}
59+
b.pass( 'benchmark finished' );
60+
b.end();
61+
});
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
{{alias}}( value )
3+
Tests if an input value is a supported array byte order.
4+
5+
Parameters
6+
----------
7+
value: any
8+
Value to test.
9+
10+
Returns
11+
-------
12+
bool: boolean
13+
Boolean indicating if an input value is a supported array byte order.
14+
15+
Examples
16+
--------
17+
> var bool = {{alias}}( 'little-endian' )
18+
true
19+
> bool = {{alias}}( 'big-endian' )
20+
true
21+
> bool = {{alias}}( '' )
22+
false
23+
> bool = {{alias}}( 'beep' )
24+
false
25+
26+
See Also
27+
--------
28+
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2024 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
// TypeScript Version: 4.1
20+
21+
/**
22+
* Tests whether an input value is a supported array byte order.
23+
*
24+
* @param v - value to test
25+
* @returns boolean indicating whether an input value is a supported array byte order
26+
*
27+
* @example
28+
* var bool = isByteOrder( 'little-endian' );
29+
* // returns true
30+
*
31+
* bool = isByteOrder( 'big-endian' );
32+
* // returns true
33+
*
34+
* bool = isByteOrder( 'foo' );
35+
* // returns false
36+
*/
37+
declare function isByteOrder( v: any ): boolean;
38+
39+
40+
// EXPORTS //
41+
42+
export = isByteOrder;
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2024 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
import isByteOrder = require( './index' );
20+
21+
22+
// TESTS //
23+
24+
// The function returns a boolean...
25+
{
26+
isByteOrder( 'little-endian' ); // $ExpectType boolean
27+
isByteOrder( 'foo' ); // $ExpectType boolean
28+
}
29+
30+
// The compiler throws an error if the function is provided an unsupported number of arguments...
31+
{
32+
isByteOrder(); // $ExpectError
33+
isByteOrder( undefined, 123 ); // $ExpectError
34+
}

0 commit comments

Comments
 (0)