Skip to content

Commit c284f90

Browse files
committed
feat: implement new sort function
1 parent 9c70f4a commit c284f90

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ async function run(args: string[], options: CliOptions = {}) {
3939
checkColumns(columns);
4040
logger.info(`processing ${rows.length} rows`);
4141

42-
sortProducts(rows);
42+
const sortedRows = sortProducts(rows, "ascending");
4343

44-
const sortedProducts = [columns, ...rows];
44+
const sortedProducts = [columns, ...sortedRows];
4545
logger.success(`sorted ${sortedProducts.length - 1} products`);
4646

4747
createCsvFile(options.output, sortedProducts);

src/output.csv

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
product_code,quantity,pick_location
22
25214,10,A 1
33
30124,5,A 1
4+
25636,1,C 8
5+
15178,9,D 4
6+
12345,15,L 3
7+
23689,10,X 10
48
12456,10,AB 9
5-
15248,10,AB 10
6-
15248,5,AB 10
9+
15248,15,AB 10
710
52568,7,AB 10
811
33331,6,AC 4
912
36389,4,AC 5
@@ -13,8 +16,4 @@ product_code,quantity,pick_location
1316
12879,12,AL 7
1417
14789,3,AM 9
1518
11224,8,AZ 4
16-
88958,4,AZ 10
17-
25636,1,C 8
18-
15178,9,D 4
19-
12345,15,L 3
20-
23689,10,X 10
19+
88958,4,AZ 10

0 commit comments

Comments
 (0)