Skip to content

Commit 3687f8c

Browse files
refactor: replace fcn with hasSameValues
1 parent bf43f4c commit 3687f8c

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

lib/node_modules/@stdlib/array/fixed-endian-factory/lib/main.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -947,9 +947,9 @@ function factory( dtype ) { // eslint-disable-line max-lines-per-function, stdli
947947
len = this._length;
948948
N = floor( len / 2 );
949949
for ( i = 0; i < N; i++ ) {
950-
j = len-i-1;
951-
tmp = buf[ GETTER ]( i*BYTES_PER_ELEMENT, this._isLE );
952-
buf[ SETTER ]( i*BYTES_PER_ELEMENT, buf[ GETTER ]( j*BYTES_PER_ELEMENT, this._isLE ), this._isLE );
950+
j = len - i - 1;
951+
tmp = buf[ GETTER ]( i * BYTES_PER_ELEMENT, this._isLE );
952+
buf[ SETTER ]( i * BYTES_PER_ELEMENT, buf[ GETTER ]( j*BYTES_PER_ELEMENT, this._isLE ), this._isLE );
953953
buf[ SETTER ]( j*BYTES_PER_ELEMENT, tmp, this._isLE );
954954
}
955955
return this;

lib/node_modules/@stdlib/array/fixed-endian-factory/test/test.reverse.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
var tape = require( 'tape' );
2424
var hasOwnProp = require( '@stdlib/assert/has-own-property' );
25+
var hasSameValues = require( '@stdlib/array/base/assert/has-same-values' );
2526
var isFunction = require( '@stdlib/assert/is-function' );
2627
var factory = require( './../lib' );
2728

@@ -95,28 +96,19 @@ tape( 'the method returns an empty array if operating on an empty typed array',
9596

9697
tape( 'the method reverses elements of a typed array in-place', function test( t ) {
9798
var expected;
98-
var values;
9999
var ctor;
100100
var arr;
101101
var out;
102-
var i;
103102

104103
ctor = factory( 'float64' );
105104
arr = new ctor( 'little-endian', [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
106-
expected = [ 5.0, 4.0, 3.0, 2.0, 1.0 ];
105+
expected = new ctor( 'little-endian', [ 5.0, 4.0, 3.0, 2.0, 1.0 ] );
107106
out = arr.reverse();
108-
values = [];
109-
fcn();
107+
110108
t.strictEqual( out instanceof ctor, true, 'returns expected value' );
111109
t.strictEqual( out, arr, 'returns expected value' );
112110
t.strictEqual( arr.length, expected.length, 'returns expected value' );
113-
t.deepEqual( values, expected, 'returns expected value' );
114-
115-
function fcn() {
116-
for ( i = 0; i < arr.length; i++ ) {
117-
values.push( arr.at( i ) );
118-
}
119-
}
111+
t.strictEqual( hasSameValues(out, expected), true, 'returns expected value' );
120112
t.end();
121113
});
122114

0 commit comments

Comments
 (0)