-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BREAKING CHANGE: countInIterable, everyInIterable and someInIterable have been removed, use reduceIterable instead
- Loading branch information
Showing
19 changed files
with
72 additions
and
59 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { applyPipe } from '../applyPipe'; | ||
import { reduceIterable } from '../iterable/reduceIterable'; | ||
import { andReducer } from './andReducer'; | ||
|
||
it('works', () => { | ||
expect(applyPipe([true, true], reduceIterable(andReducer))).toEqual(true); | ||
expect(applyPipe([true, false], reduceIterable(andReducer))).toEqual(false); | ||
expect(applyPipe([false, true], reduceIterable(andReducer))).toEqual(false); | ||
expect(applyPipe([false, false], reduceIterable(andReducer))).toEqual(false); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export const andReducer = (accumulator: boolean, value: boolean) => | ||
accumulator ? value : undefined; |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { applyPipe } from '../applyPipe'; | ||
import { reduceIterable } from '../iterable/reduceIterable'; | ||
import { countReducer } from './countReducer'; | ||
|
||
it('works', () => { | ||
expect(applyPipe([1, 2], reduceIterable(countReducer))).toEqual(2); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export const countReducer = (accumulator: number) => accumulator + 1; |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { applyPipe } from '../applyPipe'; | ||
import { reduceIterable } from '../iterable/reduceIterable'; | ||
import { maxReducer } from './maxReducer'; | ||
|
||
it('works', () => { | ||
expect(applyPipe([1, 2], reduceIterable(maxReducer))).toEqual(2); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export const maxReducer = (accumulator: number, value: number) => | ||
Math.max(accumulator, value); |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { applyPipe } from '../applyPipe'; | ||
import { reduceIterable } from '../iterable/reduceIterable'; | ||
import { minReducer } from './minReducer'; | ||
|
||
it('works', () => { | ||
expect(applyPipe([1, 2], reduceIterable(minReducer))).toEqual(1); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export const minReducer = (accumulator: number, value: number) => | ||
Math.min(accumulator, value); |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { applyPipe } from '../applyPipe'; | ||
import { reduceIterable } from '../iterable/reduceIterable'; | ||
import { orReducer } from './orReducer'; | ||
|
||
it('works', () => { | ||
expect(applyPipe([true, true], reduceIterable(orReducer))).toEqual(true); | ||
expect(applyPipe([true, false], reduceIterable(orReducer))).toEqual(true); | ||
expect(applyPipe([false, true], reduceIterable(orReducer))).toEqual(true); | ||
expect(applyPipe([false, false], reduceIterable(orReducer))).toEqual(false); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export const orReducer = (accumulator: boolean, value: boolean) => | ||
accumulator ? undefined : value; |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { applyPipe } from '../applyPipe'; | ||
import { reduceIterable } from '../iterable/reduceIterable'; | ||
import { sumReducer } from './sumReducer'; | ||
|
||
it('works', () => { | ||
expect(applyPipe([1, 2], reduceIterable(sumReducer))).toEqual(3); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export const sumReducer = (accumulator: number, value: number) => | ||
accumulator + value; |