-
Notifications
You must be signed in to change notification settings - Fork 89
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
1 parent
8cb13dc
commit 1157bfb
Showing
9 changed files
with
70 additions
and
78 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 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
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,30 +1,43 @@ | ||
import {pluck} from 'rambda' | ||
import {piped, pluck} from 'rambda' | ||
|
||
describe('R.pluck', () => { | ||
it('with object', () => { | ||
interface ListMember { | ||
a: number, | ||
b: string, | ||
} | ||
const input: ListMember[] = [ | ||
{a: 1, b: 'foo'}, | ||
{a: 2, b: 'bar'}, | ||
] | ||
describe('R.pluck - with property key', () => { | ||
const input = [ | ||
{a: 1, b: 'foo'}, | ||
{a: 2, b: 'bar'}, | ||
] | ||
it('inside piped', () => { | ||
const result = piped( | ||
input, | ||
pluck('b') | ||
) | ||
result // $ExpectType string[] | ||
}) | ||
it('without currying', () => { | ||
const resultA = pluck('a', input) | ||
const resultB = pluck('b')(input) | ||
resultA // $ExpectType number[] | ||
resultB // $ExpectType string[] | ||
}) | ||
|
||
it('with array', () => { | ||
const input = [ | ||
[1, 2], | ||
[3, 4], | ||
[5, 6], | ||
] | ||
const result = pluck(0, input) | ||
const resultCurry = pluck(0)(input) | ||
result // $ExpectType number[] | ||
resultCurry // $ExpectType number[] | ||
// @ts-expect-error | ||
pluck('b')(input) | ||
}) | ||
}) | ||
|
||
describe('R.pluck - with list index', () => { | ||
const input = [ | ||
[1, 2], | ||
[3, 4], | ||
] | ||
it('inside piped', () => { | ||
const result = piped( | ||
input, | ||
pluck(0) | ||
) | ||
result // $ExpectType number[] | ||
}) | ||
it('without currying', () => { | ||
const resultA = pluck(0, input) | ||
resultA // $ExpectType number[] | ||
|
||
// @ts-expect-error | ||
pluck(1)(input) | ||
}) | ||
}) |
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