Skip to content

Commit dcba08f

Browse files
committed
Fix implementations and update README
1 parent 6f7a9ab commit dcba08f

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

lib/node_modules/@stdlib/utils/named-typed-tuple/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,7 +1237,7 @@ var factory = namedtypedtuple( [ 'x', 'y', 'z' ] );
12371237

12381238
var tuple = factory( [ 1.0, 0.0, -1.0 ] );
12391239

1240-
bool = tuple.includes( 1.0, -2 );
1240+
var bool = tuple.includes( 1.0, -2 );
12411241
// returns false
12421242
```
12431243

@@ -1517,7 +1517,7 @@ var ctx = {
15171517
'count': 0
15181518
};
15191519

1520-
var p2 = p1.map( fcn );
1520+
var p2 = p1.map( fcn, ctx );
15211521

15221522
var n = ctx.count;
15231523
// returns 3
@@ -1539,7 +1539,7 @@ function fcn( acc, v ) {
15391539
}
15401540

15411541
var v = tuple.reduce( fcn );
1542-
// returns 9.0
1542+
// returns 11.0
15431543
```
15441544

15451545
If not provided an initial value, the method invokes a provided function with the first tuple element as the first argument and the second tuple element as the second argument.
@@ -1583,7 +1583,7 @@ function fcn( acc, v ) {
15831583
}
15841584

15851585
var v = tuple.reduceRight( fcn );
1586-
// returns 4.0
1586+
// returns 1.0
15871587
```
15881588

15891589
If not provided an initial value, the method invokes a provided function with the last tuple element as the first argument and the second-to-last tuple element as the second argument.
@@ -1875,7 +1875,7 @@ var y = tuple[ 0 ];
18751875

18761876
// Tuple field assignments do NOT change:
18771877
x = tuple.x;
1878-
// returns 2.0
1878+
// returns 0.0
18791879
```
18801880

18811881
By default, the method sorts tuple elements in ascending order. To impose a custom order, provide a `compareFunction`.
@@ -1905,7 +1905,7 @@ var z = tuple[ 1 ];
19051905
// returns 0.0
19061906

19071907
// Tuple field assignments do NOT change:
1908-
y = tuple.y;
1908+
var y = tuple.y;
19091909
// returns -3.0
19101910
```
19111911

lib/node_modules/@stdlib/utils/named-typed-tuple/docs/types/index.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ interface Tuple {
919919
* }
920920
*
921921
* var v = tuple.reduce( fcn );
922-
* // returns 9.0
922+
* // returns 11.0
923923
*/
924924
reduce( fcn: Reducer, initialValue?: any ): any;
925925

@@ -945,7 +945,7 @@ interface Tuple {
945945
* }
946946
*
947947
* var v = tuple.reduceRight( fcn );
948-
* // returns 4.0
948+
* // returns 1.0
949949
*/
950950
reduceRight( fcn: Reducer, initialValue?: any ): any;
951951

lib/node_modules/@stdlib/utils/named-typed-tuple/lib/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ function factory( names, options ) { // eslint-disable-line max-lines-per-functi
635635
throw new TypeError( 'invalid argument. Must provide an integer. Value: `' + ind + '`.' );
636636
}
637637
if ( ind < 0 ) {
638-
ind = nfields - ind;
638+
ind = nfields + ind;
639639
}
640640
if ( ind < 0 || ind >= nfields ) {
641641
return;
@@ -791,7 +791,7 @@ function factory( names, options ) { // eslint-disable-line max-lines-per-functi
791791
throw new TypeError( 'invalid invocation. `this` is not host tuple.' );
792792
}
793793
if ( arguments.length > 1 ) {
794-
i = arguments[ 0 ];
794+
i = arguments[ 1 ];
795795
if ( !isInteger( i ) ) {
796796
throw new TypeError( 'invalid argument. Second argument must be an integer. Value: `' + i + '`.' );
797797
}

0 commit comments

Comments
 (0)