File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -5700,4 +5700,27 @@ export default class SimpleTable extends Simple {
5700
5700
console . log ( `\nTable ${ this . name } : ${ formatNumber ( nbRows ) } rows.` ) ;
5701
5701
return await this ;
5702
5702
}
5703
+
5704
+ /**
5705
+ * Logs the bottom n rows. Note that the order is inverted. The last rows are logged first.
5706
+ *
5707
+ * @example
5708
+ * Basic usage
5709
+ * ```ts
5710
+ * await table.logBottom(10)
5711
+ * ```
5712
+ *
5713
+ * @param count - The number of rows to log.
5714
+ */
5715
+ async logBottom (
5716
+ count : number ,
5717
+ ) {
5718
+ console . log ( `\nTable ${ this . name } (${ count } bottom rows):` ) ;
5719
+ const data = await this . getBottom ( count ) ;
5720
+ logData (
5721
+ null ,
5722
+ data ,
5723
+ this . nbCharactersToLog ,
5724
+ ) ;
5725
+ }
5703
5726
}
Original file line number Diff line number Diff line change
1
+ import { assertEquals } from "jsr:@std/assert" ;
2
+ import SimpleDB from "../../../src/class/SimpleDB.ts" ;
3
+
4
+ Deno . test ( "should log the last rows" , async ( ) => {
5
+ const sdb = new SimpleDB ( ) ;
6
+ const table = sdb . newTable ( ) ;
7
+ await table . loadData ( "test/data/files/employees.csv" ) ;
8
+ await table . logBottom ( 5 ) ;
9
+
10
+ // How to test?
11
+ assertEquals ( true , true ) ;
12
+ await sdb . done ( ) ;
13
+ } ) ;
You can’t perform that action at this time.
0 commit comments