-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
254 changed files
with
1,535 additions
and
1,456 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
.DS_Store | ||
.nyc_output | ||
/coverage | ||
/dist | ||
/node_modules | ||
/typings | ||
npm-debug.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,3 @@ | ||
export class Enumerable<TSource> implements Iterable<TSource> { | ||
constructor(private _source: Iterable<TSource>) { | ||
} | ||
import { Enumerable } from './internal/Enumerable'; | ||
|
||
[Symbol.iterator](): Iterator<TSource> { | ||
return this._source[Symbol.iterator](); | ||
} | ||
|
||
lift<TResult>(source: Iterable<TResult>): Enumerable<TResult> { | ||
return new Enumerable(source); | ||
} | ||
} | ||
export default Enumerable; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import aggregate from '../aggregate'; | ||
import { Enumerable } from '../Enumerable'; | ||
import { Enumerable } from '../internal/Enumerable'; | ||
|
||
Enumerable.prototype.aggregate = aggregate; | ||
|
||
declare module '../Enumerable' { | ||
declare module '../internal/Enumerable' { | ||
interface Enumerable<TSource> { | ||
aggregate: typeof aggregate; | ||
aggregate<TAccumulate>(seed: TAccumulate, func: (result: TAccumulate, element: TSource) => TAccumulate): TAccumulate; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import all from '../all'; | ||
import { Enumerable } from '../Enumerable'; | ||
import { Enumerable } from '../internal/Enumerable'; | ||
|
||
Enumerable.prototype.all = all; | ||
|
||
declare module '../Enumerable' { | ||
declare module '../internal/Enumerable' { | ||
interface Enumerable<TSource> { | ||
all: typeof all; | ||
all(predicate?: (element: TSource) => boolean): boolean; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import any from '../any'; | ||
import { Enumerable } from '../Enumerable'; | ||
import { Enumerable } from '../internal/Enumerable'; | ||
|
||
Enumerable.prototype.any = any; | ||
|
||
declare module '../Enumerable' { | ||
declare module '../internal/Enumerable' { | ||
interface Enumerable<TSource> { | ||
any: typeof any; | ||
any(predicate?: (element: TSource) => boolean): boolean; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import average from '../average'; | ||
import { Enumerable } from '../Enumerable'; | ||
import { Enumerable } from '../internal/Enumerable'; | ||
|
||
Enumerable.prototype.average = average; | ||
|
||
declare module '../Enumerable' { | ||
declare module '../internal/Enumerable' { | ||
interface Enumerable<TSource> { | ||
average: typeof average; | ||
average(selector?: (element: TSource) => number): number; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
import buffer from '../lifted/buffer'; | ||
import { Enumerable } from '../Enumerable'; | ||
import bufferFn from '../buffer'; | ||
import { Enumerable } from '../internal/Enumerable'; | ||
|
||
function buffer<TSource>(this: Enumerable<TSource>, count: number, skip?: number): Enumerable<TSource[]> { | ||
return this.lift<TSource[]>(bufferFn.call(this, count, skip)); | ||
} | ||
|
||
Enumerable.prototype.buffer = buffer; | ||
|
||
declare module '../Enumerable' { | ||
declare module '../internal/Enumerable' { | ||
interface Enumerable<TSource> { | ||
buffer: typeof buffer; | ||
buffer(count: number, skip?: number): Enumerable<TSource[]>; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
import _catch from '../lifted/catch'; | ||
import { Enumerable } from '../Enumerable'; | ||
import catchFn from '../catch'; | ||
import { Enumerable } from '../internal/Enumerable'; | ||
|
||
function _catch<TSource, TException>(this: Enumerable<TSource>, handler: (exception: TException) => Iterable<TSource>): Enumerable<TSource> { | ||
return this.lift<TSource>(catchFn.call(this, handler)); | ||
} | ||
|
||
Enumerable.prototype.catch = _catch; | ||
|
||
declare module '../Enumerable' { | ||
declare module '../internal/Enumerable' { | ||
interface Enumerable<TSource> { | ||
catch: typeof _catch; | ||
catch<TException>(handler: (exception: TException) => Iterable<TSource>): Enumerable<TSource>; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
import concat from '../lifted/concat'; | ||
import { Enumerable } from '../Enumerable'; | ||
import concatFn from '../concat'; | ||
import { Enumerable } from '../internal/Enumerable'; | ||
|
||
function concat<TSource>(this: Enumerable<TSource>, ...sources: Iterable<TSource>[]): Enumerable<TSource> { | ||
return this.lift<TSource>(concatFn.apply(this, sources)); | ||
} | ||
|
||
Enumerable.prototype.concat = concat; | ||
|
||
declare module '../Enumerable' { | ||
declare module '../internal/Enumerable' { | ||
interface Enumerable<TSource> { | ||
concat: typeof concat; | ||
concat(...sources: Iterable<TSource>[]): Enumerable<TSource>; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import count from '../count'; | ||
import { Enumerable } from '../Enumerable'; | ||
import { Enumerable } from '../internal/Enumerable'; | ||
|
||
Enumerable.prototype.count = count; | ||
|
||
declare module '../Enumerable' { | ||
declare module '../internal/Enumerable' { | ||
interface Enumerable<TSource> { | ||
count: typeof count; | ||
count(predicate?: (item: TSource) => boolean): number; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
import defaultIfEmpty from '../lifted/defaultIfEmpty'; | ||
import { Enumerable } from '../Enumerable'; | ||
import defaultIfEmptyFn from '../defaultIfEmpty'; | ||
import { Enumerable } from '../internal/Enumerable'; | ||
|
||
function defaultIfEmpty<TSource>(this: Enumerable<TSource>, defaultValue: TSource): Enumerable<TSource> { | ||
return this.lift<TSource>(defaultIfEmptyFn.call(this, defaultValue)); | ||
} | ||
|
||
Enumerable.prototype.defaultIfEmpty = defaultIfEmpty; | ||
|
||
declare module '../Enumerable' { | ||
declare module '../internal/Enumerable' { | ||
interface Enumerable<TSource> { | ||
defaultIfEmpty: typeof defaultIfEmpty; | ||
defaultIfEmpty(defaultValue: TSource): Enumerable<TSource>; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
import distinct from '../lifted/distinct'; | ||
import { Enumerable } from '../Enumerable'; | ||
import distinctFn from '../distinct'; | ||
import { Enumerable } from '../internal/Enumerable'; | ||
|
||
function distinct<TSource>(this: Enumerable<TSource>): Enumerable<TSource>; | ||
function distinct<TSource, TKey>(this: Enumerable<TSource>, keySelector?: (element: TSource) => TKey): Enumerable<TSource> { | ||
return this.lift<TSource>(distinctFn.call(this, keySelector)); | ||
} | ||
|
||
Enumerable.prototype.distinct = distinct; | ||
|
||
declare module '../Enumerable' { | ||
declare module '../internal/Enumerable' { | ||
interface Enumerable<TSource> { | ||
distinct: typeof distinct; | ||
distinct(): Enumerable<TSource>; | ||
distinct<TKey>(keySelector?: (element: TSource) => TKey): Enumerable<TSource>; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
import distinctUntilChanged from '../lifted/distinctUntilChanged'; | ||
import { Enumerable } from '../Enumerable'; | ||
import distinctUntilChangedFn from '../distinctUntilChanged'; | ||
import { Enumerable } from '../internal/Enumerable'; | ||
|
||
function distinctUntilChanged<TSource>(this: Enumerable<TSource>): Enumerable<TSource>; | ||
function distinctUntilChanged<TSource, TKey>(this: Enumerable<TSource>, keySelector?: (element: TSource) => TKey): Enumerable<TSource> { | ||
return this.lift<TSource>(distinctUntilChangedFn.call(this, keySelector)); | ||
} | ||
|
||
Enumerable.prototype.distinctUntilChanged = distinctUntilChanged; | ||
|
||
declare module '../Enumerable' { | ||
declare module '../internal/Enumerable' { | ||
interface Enumerable<TSource> { | ||
distinctUntilChanged: typeof distinctUntilChanged; | ||
distinctUntilChanged(): Enumerable<TSource>; | ||
distinctUntilChanged<TKey>(keySelector?: (element: TSource) => TKey): Enumerable<TSource>; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
import _do from '../lifted/do'; | ||
import { Enumerable } from '../Enumerable'; | ||
import doFn from '../do'; | ||
import { Enumerable } from '../internal/Enumerable'; | ||
|
||
function _do<TSource>(this: Enumerable<TSource>, action: (element: TSource) => void): Enumerable<TSource> { | ||
return this.lift<TSource>(doFn.call(this, action)); | ||
} | ||
|
||
Enumerable.prototype.do = _do; | ||
|
||
declare module '../Enumerable' { | ||
declare module '../internal/Enumerable' { | ||
interface Enumerable<TSource> { | ||
do: typeof _do; | ||
do(action: (element: TSource) => void): Enumerable<TSource>; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
import doWhile from '../lifted/doWhile'; | ||
import { Enumerable } from '../Enumerable'; | ||
import doWhileFn from '../doWhile'; | ||
import { Enumerable } from '../internal/Enumerable'; | ||
|
||
function doWhile<TSource>(this: Enumerable<TSource>, condition: () => boolean): Enumerable<TSource> { | ||
return this.lift<TSource>(doWhileFn.call(this, condition)); | ||
} | ||
|
||
Enumerable.prototype.doWhile = doWhile; | ||
|
||
declare module '../Enumerable' { | ||
declare module '../internal/Enumerable' { | ||
interface Enumerable<TSource> { | ||
doWhile: typeof doWhile; | ||
doWhile(condition: () => boolean): Enumerable<TSource>; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import elementAt from '../elementAt'; | ||
import { Enumerable } from '../Enumerable'; | ||
import { Enumerable } from '../internal/Enumerable'; | ||
|
||
Enumerable.prototype.elementAt = elementAt; | ||
|
||
declare module '../Enumerable' { | ||
declare module '../internal/Enumerable' { | ||
interface Enumerable<TSource> { | ||
elementAt: typeof elementAt; | ||
elementAt(index: number): TSource; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import elementAtOrDefault from '../elementAtOrDefault'; | ||
import { Enumerable } from '../Enumerable'; | ||
import { Enumerable } from '../internal/Enumerable'; | ||
|
||
Enumerable.prototype.elementAtOrDefault = elementAtOrDefault; | ||
|
||
declare module '../Enumerable' { | ||
declare module '../internal/Enumerable' { | ||
interface Enumerable<TSource> { | ||
elementAtOrDefault: typeof elementAtOrDefault; | ||
elementAtOrDefault(index: number, defaultValue?: TSource): TSource; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
import except from '../except'; | ||
import { Enumerable } from '../Enumerable'; | ||
import exceptFn from '../except'; | ||
import { Enumerable } from '../internal/Enumerable'; | ||
|
||
function except<TSource>(this: Enumerable<TSource>, second: Iterable<TSource>): Enumerable<TSource> { | ||
return this.lift<TSource>(exceptFn.call(this, second)); | ||
} | ||
|
||
Enumerable.prototype.except = except; | ||
|
||
declare module '../Enumerable' { | ||
declare module '../internal/Enumerable' { | ||
interface Enumerable<TSource> { | ||
except: typeof except; | ||
except(second: Iterable<TSource>): Enumerable<TSource>; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
import _finally from '../finally'; | ||
import { Enumerable } from '../Enumerable'; | ||
import finallyFn from '../finally'; | ||
import { Enumerable } from '../internal/Enumerable'; | ||
|
||
function _finally<TSource>(this: Enumerable<TSource>, finallyAction: () => void): Enumerable<TSource> { | ||
return this.lift<TSource>(finallyFn.call(this, finallyAction)); | ||
} | ||
|
||
Enumerable.prototype.finally = _finally; | ||
|
||
declare module '../Enumerable' { | ||
declare module '../internal/Enumerable' { | ||
interface Enumerable<TSource> { | ||
finally: typeof _finally; | ||
finally(finallyAction: () => void): Enumerable<TSource>; | ||
} | ||
} |
Oops, something went wrong.