Skip to content

Commit 801d9d5

Browse files
committed
Auto-generated commit
1 parent a7596b8 commit 801d9d5

3 files changed

Lines changed: 64 additions & 0 deletions

File tree

CHANGELOG.md

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

1111
### Features
1212

13+
- [`f91aca6`](https://github.com/stdlib-js/stdlib/commit/f91aca6650536cb46c7b4c41bd05a2a37e0fe475) - add `maybeBroadcastArrayExceptDimensions` to namespace
1314
- [`5324e96`](https://github.com/stdlib-js/stdlib/commit/5324e9618a4b8688b4792ccceb146b348d9a9f2f) - add `ndarray/base/maybe-broadcast-array-except-dimensions` [(#10413)](https://github.com/stdlib-js/stdlib/pull/10413)
1415
- [`9df924b`](https://github.com/stdlib-js/stdlib/commit/9df924b5f0b773c8b06d06b40e54dee75059ce08) - add writable parameter support to `ndarray/base/transpose` (#10474) [(#10474)](https://github.com/stdlib-js/stdlib/pull/10474)
1516
- [`e947540`](https://github.com/stdlib-js/stdlib/commit/e947540a4e87841d7bf140094e20b2768250de11) - add writable parameter to `ndarray/base/remove-singleton-dimensions` [(#9667)](https://github.com/stdlib-js/stdlib/pull/9667)
@@ -773,6 +774,8 @@ A total of 44 issues were closed in this release:
773774

774775
<details>
775776

777+
- [`93406df`](https://github.com/stdlib-js/stdlib/commit/93406df6ffbb6494062605352b7df9c05694c81d) - **test:** add missing tests _(by Athan Reines)_
778+
- [`f91aca6`](https://github.com/stdlib-js/stdlib/commit/f91aca6650536cb46c7b4c41bd05a2a37e0fe475) - **feat:** add `maybeBroadcastArrayExceptDimensions` to namespace _(by Athan Reines)_
776779
- [`5324e96`](https://github.com/stdlib-js/stdlib/commit/5324e9618a4b8688b4792ccceb146b348d9a9f2f) - **feat:** add `ndarray/base/maybe-broadcast-array-except-dimensions` [(#10413)](https://github.com/stdlib-js/stdlib/pull/10413) _(by Muhammad Haris, Athan Reines)_
777780
- [`f10a6aa`](https://github.com/stdlib-js/stdlib/commit/f10a6aaf98c37bb630ac75e1a50dd0bd4a0eb417) - **fix:** ensure unique indices _(by Athan Reines)_
778781
- [`9df924b`](https://github.com/stdlib-js/stdlib/commit/9df924b5f0b773c8b06d06b40e54dee75059ce08) - **feat:** add writable parameter support to `ndarray/base/transpose` (#10474) [(#10474)](https://github.com/stdlib-js/stdlib/pull/10474) _(by Muhammad Haris, Athan Reines)_

base/broadcast-array-except-dimensions/test/test.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,58 @@ tape( 'the function throws an error if provided a desired shape and an input arr
123123
}
124124
});
125125

126+
tape( 'the function throws an error if provided duplicate dimensions', function test( t ) {
127+
var values;
128+
var x;
129+
var i;
130+
131+
x = array({
132+
'shape': [ 2, 10, 10 ]
133+
});
134+
135+
values = [
136+
[ -3, -3 ],
137+
[ -2, -2 ],
138+
[ -1, -1 ]
139+
];
140+
for ( i = 0; i < values.length; i++ ) {
141+
t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ['+values[ i ].join( ',')+']' );
142+
}
143+
t.end();
144+
145+
function badValue( value ) {
146+
return function badValue() {
147+
broadcastArrayExceptDimensions( x, [ 2, 10, 10 ], value );
148+
};
149+
}
150+
});
151+
152+
tape( 'the function throws an error if provided out-of-bounds dimensions', function test( t ) {
153+
var values;
154+
var x;
155+
var i;
156+
157+
x = array({
158+
'shape': [ 2, 10, 10 ]
159+
});
160+
161+
values = [
162+
[ -4 ],
163+
[ -5 ],
164+
[ -6 ]
165+
];
166+
for ( i = 0; i < values.length; i++ ) {
167+
t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ['+values[ i ].join( ',')+']' );
168+
}
169+
t.end();
170+
171+
function badValue( value ) {
172+
return function badValue() {
173+
broadcastArrayExceptDimensions( x, [ 2, 10, 10 ], value );
174+
};
175+
}
176+
});
177+
126178
tape( 'the function returns a "base" ndarray instance', function test( t ) {
127179
var x;
128180
var y;

base/lib/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,15 @@ setReadOnly( ns, 'maxViewBufferIndex', require( './../../base/max-view-buffer-in
724724
*/
725725
setReadOnly( ns, 'maybeBroadcastArray', require( './../../base/maybe-broadcast-array' ) );
726726

727+
/**
728+
* @name maybeBroadcastArrayExceptDimensions
729+
* @memberof ns
730+
* @readonly
731+
* @type {Function}
732+
* @see {@link module:@stdlib/ndarray/base/maybe-broadcast-array-except-dimensions}
733+
*/
734+
setReadOnly( ns, 'maybeBroadcastArrayExceptDimensions', require( './../../base/maybe-broadcast-array-except-dimensions' ) );
735+
727736
/**
728737
* @name maybeBroadcastArrays
729738
* @memberof ns

0 commit comments

Comments
 (0)