katanakit-js / IAstroService
Interface: IAstroService
Defined in: src/types/index.ts:759
Contract of the Astro facade.
Methods
useExtractUniqueValues()
ts
useExtractUniqueValues<T, V>(items, keyFrom): V[];Defined in: src/types/index.ts:783
Type Parameters
| Type Parameter |
|---|
T |
V |
Parameters
| Parameter | Type |
|---|---|
items | T[] |
keyFrom | (item) => V | V[] |
Returns
V[]
useFindEntry()
ts
useFindEntry<T>(
items,
value,
keyFrom?
): T | null;Defined in: src/types/index.ts:773
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
items | T[] |
value | string |
keyFrom? | (item) => string | number |
Returns
T | null
useGeneratePagination()
ts
useGeneratePagination<T, TParam>(
items,
pageSize?,
param?
): AstroPath<TParam, PaginationProps<T>>[];Defined in: src/types/index.ts:774
Type Parameters
| Type Parameter | Default type |
|---|---|
T | - |
TParam extends string | "page" |
Parameters
| Parameter | Type |
|---|---|
items | T[] |
pageSize? | number |
param? | TParam |
Returns
AstroPath<TParam, PaginationProps<T>>[]
useGetStaticPaths()
ts
useGetStaticPaths<TData, TParam, TProps>(
getCollectionFn,
collectionName,
options?
): Promise<AstroServiceResult<AstroPath<TParam, TProps>[]>>;Defined in: src/types/index.ts:764
Type Parameters
| Type Parameter | Default type |
|---|---|
TData | unknown |
TParam extends string | "slug" |
TProps | CollectionEntryLike<TData> |
Parameters
| Parameter | Type |
|---|---|
getCollectionFn | (collection) => Promise<CollectionEntryLike<TData>[]> |
collectionName | string |
options? | PathsOptions<CollectionEntryLike<TData>, TParam, TProps> |
Returns
Promise<AstroServiceResult<AstroPath<TParam, TProps>[]>>
usePathsFrom()
ts
usePathsFrom<T, TParam, TProps>(items, options?): AstroPath<TParam, TProps>[];Defined in: src/types/index.ts:760
Type Parameters
| Type Parameter | Default type |
|---|---|
T | - |
TParam extends string | "slug" |
TProps | T |
Parameters
| Parameter | Type |
|---|---|
items | T[] |
options? | PathsOptions<T, TParam, TProps> |
Returns
AstroPath<TParam, TProps>[]
usePathsFromValues()
ts
usePathsFromValues<TParam>(values, param?): AstroPath<TParam, string | number>[];Defined in: src/types/index.ts:779
Type Parameters
| Type Parameter | Default type |
|---|---|
TParam extends string | "slug" |
Parameters
| Parameter | Type |
|---|---|
values | (string | number)[] |
param? | TParam |
Returns
AstroPath<TParam, string | number>[]