Skip to content

Commit

Permalink
chore@small
Browse files Browse the repository at this point in the history
  • Loading branch information
selfrefactor committed Jan 16, 2025
1 parent 91b9f85 commit 0e1414d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
12 changes: 12 additions & 0 deletions files/NEXT_VERSION_CHECKLIST.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
takelast

https://github.com/selfrefactor/rambda/discussions/758


---
ABOVE IS DONE
---
Expand Down Expand Up @@ -123,6 +125,16 @@ assocpath
---
bench against https://romgrk.com/posts/optimizing-javascript#3-avoid-arrayobject-methods
---
R.path with string path - check typehero notes
---
let result = piped(
input,
split(`\n`),
map(trim),
filter(x => Boolean(x)),

why cannot filter(boolean) be used
---

export const getTestData = <K extends keyof TestData>(key: K) => {
if (!TEST_DATA) return null
Expand Down
11 changes: 3 additions & 8 deletions files/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4005,10 +4005,7 @@ Notes:
// @SINGLE_MARKER
export function take<T>(howMany: number, input: T[]): T[];
export function take(howMany: number, input: string): string;
export function take<T>(howMany: number): {
<T>(input: T[]): T[];
(input: string): string;
};
export function take<T>(howMany: number) : (input: T[]) => T[];

/*
Method: takeLast
Expand All @@ -4035,10 +4032,8 @@ Notes:
// @SINGLE_MARKER
export function takeLast<T>(howMany: number, input: T[]): T[];
export function takeLast(howMany: number, input: string): string;
export function takeLast<T>(howMany: number): {
<T>(input: T[]): T[];
(input: string): string;
};
export function takeLast<T>(howMany: number) : (input: T[]) => T[];


/*
Method: tap
Expand Down
13 changes: 12 additions & 1 deletion source/takeLast-spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {takeLast} from 'rambda'
import {filter, piped, takeLast} from 'rambda'

const list = [1, 2, 3, 4]
const str = 'foobar'
Expand All @@ -15,6 +15,17 @@ describe('R.takeLast - array', () => {

result // $ExpectType number[]
})
it('real case', () => {
let data = ['foo']
let result = piped(
data,
filter(
x => x.length >= 100
),
takeLast(5),
)
result // $ExpectType string[]
})
})

describe('R.takeLast - string', () => {
Expand Down

0 comments on commit 0e1414d

Please sign in to comment.