Skip to content

Commit

Permalink
Try to fix Azure Pipelines on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
arogozine committed Jul 1, 2023
1 parent d35ac94 commit 2e88379
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 8 deletions.
15 changes: 13 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,49 +19,60 @@ pool:
steps:
- task: NodeTool@0
inputs:
versionSource: 'spec'
versionSpec: 18.x

checkLatest: true
- script: |
npm install -g typescript jest typedoc
displayName: 'Install Globals'
continueOnError: false
- script: |
npm install
npm run build
displayName: 'Build Library'
continueOnError: false
- script: npm run lint
displayName: 'Run Lint'
continueOnError: false
- script: npm run doc
displayName: 'Run Type Doc'
continueOnError: false
- script: |
cd tests/unittests
npm install
npm run test
displayName: 'Run Unit Tests'
continueOnError: false
- script: |
cd tests/nodetest
npm install
tsc
node index.js
displayName: 'Test Node'
continueOnError: false
- script: |
cd tests/reacttest
npm install
npm run build
displayName: 'Test React'
continueOnError: false
- script: |
cd tests/moduletest
npm install
tsc
node index.js
displayName: 'Test Modules'
continueOnError: false
- script: |
cd tests/esmtest
npm install
tsc
node index.js
displayName: 'Test ESM Modules'
continueOnError: false
- script: |
cd examples
npm install
npm run test
displayName: 'Test Examples'
displayName: 'Test Examples'
continueOnError: false
4 changes: 2 additions & 2 deletions examples/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ declare global {
[1, 2].all((x) => x < 2); // false

// APPEND
[1, 2].append(3); // [1, 2, 3]
// [1, 2].append(3); // [1, 2, 3]

// ANY
[0].any(); // true
Expand Down Expand Up @@ -113,7 +113,7 @@ const groupByBreed = cats.groupBy((cat) => cat.breed);
[3, 4, 7, 0, 1].orderBy((x) => x); // [0, 1, 3, 4, 7]

// PREPEND
[1, 2].prepend(3); // [3, 1, 2]
// [1, 2].prepend(3); // [3, 1, 2]

// REVERSE
[1, 2, 3].reverse(); // [3, 2, 1]
Expand Down
2 changes: 1 addition & 1 deletion examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"license": "ISC",
"dependencies": {
"@types/node": "^18.11.18",
"linq-to-typescript": "^10.0.0-beta1"
"linq-to-typescript": "^11.0.0"
},
"devDependencies": {
"typescript": "^4.7.4"
Expand Down
4 changes: 4 additions & 0 deletions src/initializer/bindLinq.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ import { maxAsync } from "./../sync/_private/maxAsync"
import { min } from "./../sync/_private/min"
import { minAsync } from "./../sync/_private/minAsync"
import { ofType } from "./../sync/_private/ofType"
import { order } from "./../sync/_private/order"
import { orderBy } from "./../sync/_private/orderBy"
import { orderByAsync } from "./../sync/_private/orderByAsync"
import { orderByDescending } from "./../sync/_private/orderByDescending"
import { orderByDescendingAsync } from "./../sync/_private/orderByDescendingAsync"
import { orderDescending } from "./../sync/_private/orderDescending"
import { partition } from "./../sync/_private/partition"
import { partitionAsync } from "./../sync/_private/partitionAsync"
import { prepend } from "../sync/_private/prepend"
Expand Down Expand Up @@ -153,10 +155,12 @@ export const bindLinq = <T, Y extends Iterable<T>>(object: IPrototype<Y>) => {
bind(min, "min")
bind(minAsync, "minAsync")
bind(ofType, "ofType")
bind(order, "order")
bind(orderBy, "orderBy")
bind(orderByAsync, "orderByAsync")
bind(orderByDescending, "orderByDescending")
bind(orderByDescendingAsync, "orderByDescendingAsync")
bind(orderDescending, "orderDescending")
bind(prepend, "prepend")
bind(reverse, "reverse")
bind(select, "select")
Expand Down
8 changes: 8 additions & 0 deletions src/sync/_private/order.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { IComparer, IEnumerable, IOrderedEnumerable } from "../../types"
import { OrderedEnumerable } from "../OrderedEnumerable"

export const order = <TSource>(
source: IEnumerable<TSource>,
comparer?: IComparer<TSource>): IOrderedEnumerable<TSource> => {
return OrderedEnumerable.generate<TSource, TSource>(source, (x: TSource) => x, true, comparer)
}
4 changes: 1 addition & 3 deletions src/sync/_private/orderBy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { IComparer } from "../../types/IComparer"
import { IEnumerable } from "../../types/IEnumerable"
import { IOrderedEnumerable } from "../../types/IOrderedEnumerable"
import { IComparer, IEnumerable, IOrderedEnumerable } from "../../types"
import { OrderedEnumerable } from "../OrderedEnumerable"

export const orderBy = <TSource, TKey>(
Expand Down
8 changes: 8 additions & 0 deletions src/sync/_private/orderDescending.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { IComparer, IEnumerable, IOrderedEnumerable } from "../../types"
import { OrderedEnumerable } from "../OrderedEnumerable"

export const orderDescending = <TSource>(
source: IEnumerable<TSource>,
comparer?: IComparer<TSource>): IOrderedEnumerable<TSource> => {
return OrderedEnumerable.generate<TSource, TSource>(source, (x: TSource) => x, false, comparer)
}
14 changes: 14 additions & 0 deletions src/types/IEnumerable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,13 @@ export interface IEnumerable<TSource> extends Iterable<TSource> {
* @returns Values that match the type string or are instance of type
*/
ofType<T extends OfType>(type: T): IEnumerable<InferType<T>>
/**
* Sorts the elements of a sequence in ascending order by using a specified or default comparer.
* @param comparer An IComparer<T> to compare values. Optional.
* @returns An IOrderedEnumerable<TElement> whose elements are sorted.
*/
order(
comparer?: IComparer<TSource>): IOrderedEnumerable<TSource>
/**
* Sorts the elements of a sequence in ascending order by using a specified or default comparer.
* @param keySelector A function to extract a key from an element.
Expand Down Expand Up @@ -488,6 +495,13 @@ export interface IEnumerable<TSource> extends Iterable<TSource> {
orderByDescendingAsync<TKey>(
predicate: (x: TSource) => Promise<TKey>,
comparer?: IComparer<TKey>): IOrderedAsyncEnumerable<TSource>
/**
* Sorts the elements of a sequence in descending order by using a specified or default comparer.
* @param comparer An IComparer<T> to compare values. Optional.
* @returns An IOrderedEnumerable<TElement> whose elements are sorted in descending order.
*/
orderDescending(
comparer?: IComparer<TSource>): IOrderedEnumerable<TSource>
/**
* Partitions the values into a tuple of failing and passing arrays
* @param predicate Predicate to determine whether a value passes or fails
Expand Down

0 comments on commit 2e88379

Please sign in to comment.