Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
♻️ Use colon instead of space in order-by pipe
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Nov 15, 2020
1 parent e54ddd9 commit cf873b1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/pipes/order-by.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class OrderByPipe implements PipeTransform {
const rules = value.split(',').map((val) => val.trim());
const orderBy: Record<string, 'asc' | 'desc'> = {};
rules.forEach((rule) => {
const [key, order] = rule.split(' ') as [string, 'asc' | 'desc'];
const [key, order] = rule.split(':') as [string, 'asc' | 'desc'];
if (!['asc', 'desc'].includes(order.toLocaleLowerCase()))
throw new BadGatewayException(ORDER_BY_ASC_DESC);
orderBy[key] = order.toLocaleLowerCase() as 'asc' | 'desc';
Expand Down

0 comments on commit cf873b1

Please sign in to comment.