Loading...
Loading...
Add missing JSDoc docblocks to exported symbols in TypeScript projects. Use when writing new exports or when code is missing documentation.
npx skill4agent add lorisleiva/skills ts-docblocks/****/@param@typeParam@return@throws@example{@link ...}@see/****/@summary@param@typeParam@typeParam@template@return@throws@example@exampleanyimportmyUser/* ... */@remarks@deprecated{@link ...}@see@see {@link ...}/**
* Creates a retry wrapper around an async function.
*
* Retries the given function up to `maxRetries` times with exponential
* backoff between attempts.
*
* @param fn - The async function to retry.
* @param maxRetries - Maximum number of retry attempts.
* @param baseDelay - Base delay in milliseconds between retries.
* @return A wrapped version of `fn` that retries on failure.
* @throws Throws the last error if all retry attempts are exhausted.
*
* @example
* ```ts
* const fetchWithRetry = withRetry(fetchData, 3, 1000);
* const data = await fetchWithRetry('/api/users');
* ```
*
* @example
* Custom retry configuration for flaky network calls.
* ```ts
* const resilientFetch = withRetry(
* () => fetch('https://api.example.com/data'),
* 5,
* 500,
* );
* ```
*/
export function withRetry<T>(
fn: (...args: unknown[]) => Promise<T>,
maxRetries: number,
baseDelay: number,
): (...args: unknown[]) => Promise<T>;/**
* Fixes a `Uint8Array` to the specified length.
*
* If the array is longer than the specified length, it is truncated.
* If the array is shorter than the specified length, it is padded with zeroes.
*
* @param bytes - The byte array to truncate or pad.
* @param length - The desired length of the byte array.
* @return The byte array truncated or padded to the desired length.
*
* @example
* Truncates the byte array to the desired length.
* ```ts
* const bytes = new Uint8Array([0x01, 0x02, 0x03, 0x04]);
* const fixedBytes = fixBytes(bytes, 2);
* // ^ [0x01, 0x02]
* ```
*
* @example
* Adds zeroes to the end of the byte array to reach the desired length.
* ```ts
* const bytes = new Uint8Array([0x01, 0x02]);
* const fixedBytes = fixBytes(bytes, 4);
* // ^ [0x01, 0x02, 0x00, 0x00]
* ```
*/
export const fixBytes = (
bytes: ReadonlyUint8Array | Uint8Array,
length: number,
): ReadonlyUint8Array | Uint8Array;/**
* A tree structure representing a set of instructions with execution constraints.
*
* Supports parallel execution, sequential execution, and combinations of both
* through recursive composition of plan nodes.
*
* @example
* ```ts
* const plan: InstructionPlan = parallelPlan([
* sequentialPlan([instructionA, instructionB]),
* instructionC,
* instructionD,
* ]);
* ```
*
* @see {@link SingleInstructionPlan}
* @see {@link ParallelInstructionPlan}
* @see {@link SequentialInstructionPlan}
*/
export type InstructionPlan =
| ParallelInstructionPlan
| SequentialInstructionPlan
| SingleInstructionPlan;[path]src/utilspackages/my-lib/src[--all].ts.tsx.js.jsxexport functionexport classexport interfaceexport typeexport const--all