Skip to content

Commit

Permalink
fix: removed operator #deploy_branch
Browse files Browse the repository at this point in the history
  • Loading branch information
lostfields committed Aug 14, 2024
1 parent d8f2969 commit 0c40573
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
17 changes: 11 additions & 6 deletions src/linq/operators/orderbyoperator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@ export class OrderByOperator<TEntity> extends Operator<TEntity> {

public * evaluate(items: Iterable<TEntity>): IterableIterator<TEntity> {
let ar = Array.from(items);
ar.sort((a, b) => {
return a[this.property] == b[this.property] ? 0 : a[this.property] < b[this.property] ? -1 : 1;
})

if(this.removed == false) {
ar.sort((a, b) => {
return a[this.property] == b[this.property] ? 0 : a[this.property] < b[this.property] ? -1 : 1;
})
}

yield* ar;
}
Expand All @@ -37,9 +40,11 @@ export class OrderByOperator<TEntity> extends Operator<TEntity> {
for await(let item of items)
ar.push(item);

ar.sort((a, b) => {
return a[this.property] == b[this.property] ? 0 : a[this.property] < b[this.property] ? -1 : 1;
})
if(this.removed == false) {
ar.sort((a, b) => {
return a[this.property] == b[this.property] ? 0 : a[this.property] < b[this.property] ? -1 : 1;
})
}

yield* ar;
}
Expand Down
2 changes: 1 addition & 1 deletion src/linq/operators/whereoperator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class WhereOperator<TEntity> extends Operator<TEntity> {

public* evaluate(items: Iterable<TEntity>): IterableIterator<TEntity> {
for (let item of items)
if (this._predicate(item)) yield item;
if (this.removed || this._predicate(item)) yield item;
}

public async * evaluateAsync(items: AsyncIterable<TEntity>): AsyncIterableIterator<TEntity> {
Expand Down

0 comments on commit 0c40573

Please sign in to comment.