diff --git a/src/linq/operators/orderbyoperator.ts b/src/linq/operators/orderbyoperator.ts index 5d37f42..5d6a0fe 100644 --- a/src/linq/operators/orderbyoperator.ts +++ b/src/linq/operators/orderbyoperator.ts @@ -25,9 +25,12 @@ export class OrderByOperator extends Operator { public * evaluate(items: Iterable): IterableIterator { 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; } @@ -37,9 +40,11 @@ export class OrderByOperator extends Operator { 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; } diff --git a/src/linq/operators/whereoperator.ts b/src/linq/operators/whereoperator.ts index d79fd12..ce911a8 100644 --- a/src/linq/operators/whereoperator.ts +++ b/src/linq/operators/whereoperator.ts @@ -76,7 +76,7 @@ export class WhereOperator extends Operator { public* evaluate(items: Iterable): IterableIterator { for (let item of items) - if (this._predicate(item)) yield item; + if (this.removed || this._predicate(item)) yield item; } public async * evaluateAsync(items: AsyncIterable): AsyncIterableIterator {