@@ -45,7 +45,7 @@ function foldr(fun, acc0, list) {
4545
4646function keyfind ( key , n , tupleList ) {
4747 for ( const tuple of tupleList ) {
48- if ( tuple . get ( n ) === key ) {
48+ if ( tuple . get ( n - 1 ) === key ) {
4949 return tuple ;
5050 }
5151 }
@@ -65,7 +65,7 @@ function keyreplace(key, n, tupleList, newTuple) {
6565 const newTupleList = [ ...tupleList ] ;
6666
6767 for ( let index = 0 ; index < newTupleList . length ; index ++ ) {
68- if ( newTupleList [ index ] . get ( n ) === key ) {
68+ if ( newTupleList [ index ] . get ( n - 1 ) === key ) {
6969 newTupleList [ index ] = newTuple ;
7070 return newTupleList ;
7171 }
@@ -78,9 +78,9 @@ function keysort(n, tupleList) {
7878 const newTupleList = [ ...tupleList ] ;
7979
8080 return newTupleList . sort ( ( a , b ) => {
81- if ( a . get ( n ) < b . get ( n ) ) {
81+ if ( a . get ( n - 1 ) < b . get ( n - 1 ) ) {
8282 return - 1 ;
83- } else if ( a . get ( n ) > b . get ( n ) ) {
83+ } else if ( a . get ( n - 1 ) > b . get ( n - 1 ) ) {
8484 return 1 ;
8585 }
8686
@@ -92,7 +92,7 @@ function keystore(key, n, tupleList, newTuple) {
9292 const newTupleList = [ ...tupleList ] ;
9393
9494 for ( let index = 0 ; index < newTupleList . length ; index ++ ) {
95- if ( newTupleList [ index ] . get ( n ) === key ) {
95+ if ( newTupleList [ index ] . get ( n - 1 ) === key ) {
9696 newTupleList [ index ] = newTuple ;
9797 return newTupleList ;
9898 }
@@ -106,7 +106,7 @@ function keydelete(key, n, tupleList) {
106106 let deleted = false ;
107107
108108 for ( let index = 0 ; index < tupleList . length ; index ++ ) {
109- if ( deleted === false && tupleList [ index ] . get ( n ) === key ) {
109+ if ( deleted === false && tupleList [ index ] . get ( n - 1 ) === key ) {
110110 deleted = true ;
111111 } else {
112112 newTupleList . push ( tupleList [ index ] ) ;
@@ -121,7 +121,7 @@ function keytake(key, n, tupleList) {
121121
122122 if ( result !== false ) {
123123 return new ErlangTypes . Tuple (
124- result . get ( n ) ,
124+ result . get ( n - 1 ) ,
125125 result ,
126126 keydelete ( key , n , tupleList )
127127 ) ;
0 commit comments