Skip to content

Commit 0e0154c

Browse files
committed
style: insert toReversed in alphabetic order in array/fixed-endian-factory
1 parent 328ba9d commit 0e0154c

File tree

1 file changed

+32
-32
lines changed
  • lib/node_modules/@stdlib/array/fixed-endian-factory/lib

1 file changed

+32
-32
lines changed

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

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -963,38 +963,6 @@ function factory( dtype ) { // eslint-disable-line max-lines-per-function, stdli
963963
return acc;
964964
});
965965

966-
/**
967-
* Returns a new typed array containing the elements in reversed order.
968-
*
969-
* @private
970-
* @name toReversed
971-
* @memberof TypedArray.prototype
972-
* @type {Function}
973-
* @throws {TypeError} `this` is not a typed array
974-
* @returns {TypedArray} reversed array
975-
*/
976-
setReadOnly( TypedArray.prototype, 'toReversed', function toReversed() {
977-
var obuf;
978-
var out;
979-
var len;
980-
var buf;
981-
var i;
982-
var v;
983-
984-
if ( !isTypedArray( this ) ) {
985-
throw new TypeError( 'invalid invocation. `this` is not a typed array.' );
986-
}
987-
len = this._length;
988-
out = new this.constructor( flag2byteOrder( this._isLE ), len );
989-
buf = this._buffer;
990-
obuf = out._buffer; // eslint-disable-line no-underscore-dangle
991-
for ( i = 0; i < len; i++ ) {
992-
v = buf[ GETTER ]( ( len - i - 1 ) * BYTES_PER_ELEMENT, this._isLE );
993-
obuf[ SETTER ]( i * BYTES_PER_ELEMENT, v, this._isLE );
994-
}
995-
return out;
996-
});
997-
998966
/**
999967
* Sets an array element.
1000968
*
@@ -1121,6 +1089,38 @@ function factory( dtype ) { // eslint-disable-line max-lines-per-function, stdli
11211089
return false;
11221090
});
11231091

1092+
/**
1093+
* Returns a new typed array containing the elements in reversed order.
1094+
*
1095+
* @private
1096+
* @name toReversed
1097+
* @memberof TypedArray.prototype
1098+
* @type {Function}
1099+
* @throws {TypeError} `this` is not a typed array
1100+
* @returns {TypedArray} reversed array
1101+
*/
1102+
setReadOnly( TypedArray.prototype, 'toReversed', function toReversed() {
1103+
var obuf;
1104+
var out;
1105+
var len;
1106+
var buf;
1107+
var i;
1108+
var v;
1109+
1110+
if ( !isTypedArray( this ) ) {
1111+
throw new TypeError( 'invalid invocation. `this` is not a typed array.' );
1112+
}
1113+
len = this._length;
1114+
out = new this.constructor( flag2byteOrder( this._isLE ), len );
1115+
buf = this._buffer;
1116+
obuf = out._buffer; // eslint-disable-line no-underscore-dangle
1117+
for ( i = 0; i < len; i++ ) {
1118+
v = buf[ GETTER ]( ( len - i - 1 ) * BYTES_PER_ELEMENT, this._isLE );
1119+
obuf[ SETTER ]( i * BYTES_PER_ELEMENT, v, this._isLE );
1120+
}
1121+
return out;
1122+
});
1123+
11241124
/**
11251125
* Serializes an array as a string.
11261126
*

0 commit comments

Comments
 (0)