-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflat-parse.d.ts
More file actions
34 lines (29 loc) · 766 Bytes
/
flat-parse.d.ts
File metadata and controls
34 lines (29 loc) · 766 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import type { Bookmark, Folder, Truthy } from './parse.d.ts'
import type { AllAttrKeys } from '../attrs.d.ts'
type FlatFolder = Omit<Folder, 'items'>
export type FlatBookmark = Bookmark & {
folder: FlatFolder[]
}
type WithId<T> = T & { id: number }
export type FlatBookmarkWithId = WithId<
Bookmark & {
folder: WithId<FlatFolder>[]
}
>
// Overload signatures.
export function flatParse<T = FlatBookmark>(
text: string,
options?: Partial<{
excludeAttrs: AllAttrKeys[]
withId: false
transform: (item: FlatBookmark) => T
}>
): Truthy<T>[]
export function flatParse<T = FlatBookmarkWithId>(
text: string,
options: {
excludeAttrs?: AllAttrKeys[]
withId: true
transform?: (item: FlatBookmarkWithId) => T
}
): Truthy<T>[]